mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
More refactoring.
This commit is contained in:
parent
e182ddd68f
commit
97a70ea882
1 changed files with 16 additions and 9 deletions
|
@ -794,9 +794,18 @@ class FreeCellSolver_Hint(Base_Solver_Hint):
|
||||||
game_type = self.game_type
|
game_type = self.game_type
|
||||||
return ('preset' in game_type and game_type['preset'] == 'simple_simon')
|
return ('preset' in game_type and game_type['preset'] == 'simple_simon')
|
||||||
|
|
||||||
|
def _addBoardLine(self, l):
|
||||||
|
self.board += l + '\n'
|
||||||
|
return
|
||||||
|
|
||||||
|
def _addPrefixLine(self, prefix, b):
|
||||||
|
if b:
|
||||||
|
self._addBoardLine(prefix + b)
|
||||||
|
return
|
||||||
|
|
||||||
def calcBoardString(self):
|
def calcBoardString(self):
|
||||||
game = self.game
|
game = self.game
|
||||||
board = ''
|
self.board = ''
|
||||||
is_simple_simon = self._isSimpleSimon()
|
is_simple_simon = self._isSimpleSimon()
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -804,15 +813,13 @@ class FreeCellSolver_Hint(Base_Solver_Hint):
|
||||||
for s in game.s.foundations:
|
for s in game.s.foundations:
|
||||||
if s.cards:
|
if s.cards:
|
||||||
b += ' ' + self.card2str2(s.cards[0 if is_simple_simon else -1])
|
b += ' ' + self.card2str2(s.cards[0 if is_simple_simon else -1])
|
||||||
if b:
|
self._addPrefixLine('Founds:', b)
|
||||||
board += 'Founds:' + b + '\n'
|
|
||||||
#
|
|
||||||
b = ''
|
b = ''
|
||||||
for s in game.s.reserves:
|
for s in game.s.reserves:
|
||||||
b += ' ' + (self.card2str1(s.cards[-1]) if s.cards else '-')
|
b += ' ' + (self.card2str1(s.cards[-1]) if s.cards else '-')
|
||||||
if b:
|
self._addPrefixLine('FC:', b)
|
||||||
board += 'FC:' + b + '\n'
|
|
||||||
#
|
|
||||||
for s in game.s.rows:
|
for s in game.s.rows:
|
||||||
b = ''
|
b = ''
|
||||||
for c in s.cards:
|
for c in s.cards:
|
||||||
|
@ -820,9 +827,9 @@ class FreeCellSolver_Hint(Base_Solver_Hint):
|
||||||
if not c.face_up:
|
if not c.face_up:
|
||||||
cs = '<%s>' % cs
|
cs = '<%s>' % cs
|
||||||
b += cs + ' '
|
b += cs + ' '
|
||||||
board += b.strip() + '\n'
|
self._addBoardLine(b.strip())
|
||||||
|
|
||||||
return board
|
return self.board
|
||||||
|
|
||||||
|
|
||||||
def computeHints(self):
|
def computeHints(self):
|
||||||
|
|
Loading…
Add table
Reference in a new issue