1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00

Refactoring

This commit is contained in:
Shlomi Fish 2017-12-27 14:58:37 +02:00
parent 780ac558d5
commit 76ba6f7d2b

View file

@ -743,15 +743,18 @@ class Base_Solver_Hint:
def config(self, **kw):
self.options.update(kw)
def card2str1(self, card):
def _card2str_format(self, fmt, card):
# row and reserves
rank = (card.rank-self.base_rank) % 13
return "A23456789TJQK"[rank] + "CSHD"[card.suit]
return fmt % {'R': "A23456789TJQK"[rank], 'S': "CSHD"[card.suit]}
def card2str1(self, card):
# row and reserves
return self._card2str_format('%(R)s%(S)s', card)
def card2str2(self, card):
# foundations
rank = (card.rank-self.base_rank) % 13
return "CSHD"[card.suit] + "-" + "A23456789TJQK"[rank]
return self._card2str_format('%(S)-s%(R)s', card)
# hard solvable: Freecell #47038300998351211829 (65539 iters)