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 2019-06-04 15:27:37 +03:00
parent d8e7a3e3ef
commit 7bbddccf80

View file

@ -1896,17 +1896,17 @@ You have reached
def checkForWin(self): def checkForWin(self):
won, status, updated = self.getWinStatus() won, status, updated = self.getWinStatus()
if not won: if not won:
return 0 return False
self.finishMove() # just in case self.finishMove() # just in case
if self.preview: if self.preview:
return 1 return True
if self.finished: if self.finished:
return 1 return True
if self.demo: if self.demo:
return status return status
if TOOLKIT == 'kivy': if TOOLKIT == 'kivy':
if not self.app.opt.display_win_message: if not self.app.opt.display_win_message:
return 1 return True
self.top.waitAnimation() self.top.waitAnimation()
if status == 2: if status == 2:
top_msg = self.updateStats() top_msg = self.updateStats()
@ -1963,7 +1963,7 @@ Congratulations, you did it !
strings=(_("&New game"), _("&Restart"), _("&Cancel"))) strings=(_("&New game"), _("&Restart"), _("&Cancel")))
self.updateMenus() self.updateMenus()
if TOOLKIT == 'kivy': if TOOLKIT == 'kivy':
return 1 return True
if d.status == 0 and d.button == 0: if d.status == 0 and d.button == 0:
# new game # new game
self.endGame() self.endGame()
@ -1971,7 +1971,7 @@ Congratulations, you did it !
elif d.status == 0 and d.button == 1: elif d.status == 0 and d.button == 1:
# restart game # restart game
self.restartGame() self.restartGame()
return 1 return True
# #
# Game - subclass overridable methods (but usually not) # Game - subclass overridable methods (but usually not)
@ -1981,7 +1981,7 @@ Congratulations, you did it !
# default: all Foundations must be filled # default: all Foundations must be filled
c = 0 c = 0
for s in self.s.foundations: for s in self.s.foundations:
c = c + len(s.cards) c += len(s.cards)
return c == len(self.cards) return c == len(self.cards)
def getFoundationDir(self): def getFoundationDir(self):
@ -1992,11 +1992,7 @@ Congratulations, you did it !
# determine the real number of player_moves # determine the real number of player_moves
def getPlayerMoves(self): def getPlayerMoves(self):
player_moves = self.stats.player_moves return self.stats.player_moves
# if self.moves.index > 0 and
# self.stats.demo_moves == self.moves.index:
# player_moves = 0
return player_moves
def updateTime(self): def updateTime(self):
if self.finished: if self.finished: