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

Extract a method or a function.

This is Refactoring / code cleanup.

See:

* https://refactoring.com/catalog/extractMethod.html

* https://en.wikipedia.org/wiki/Code_refactoring

* https://www.refactoring.com/

* https://www.joelonsoftware.com/2002/01/23/rub-a-dub-dub/

Some small optimisations may have slipped in as well.
This commit is contained in:
Shlomi Fish 2019-08-14 20:49:03 +03:00
parent 6ddacc7d27
commit 39a4978357

View file

@ -396,6 +396,16 @@ class GameStatsStruct(NewStruct):
elapsed_time = attr.ib(default=0.0)
pause_start_time = attr.ib(default=0.0)
def _reset_statistics(self):
"""docstring for _reset_stats"""
self.undo_moves = 0
self.redo_moves = 0
self.player_moves = 0
self.demo_moves = 0
self.total_moves = 0
self.quickplay_moves = 0
self.goto_bookmark_moves = 0
_GLOBAL_U_PLAY = 0
@ -2756,14 +2766,7 @@ class Game(object):
index=0,
current=[], # atomic moves for the current move
)
# reset statistics
self.stats.undo_moves = 0
self.stats.redo_moves = 0
self.stats.player_moves = 0
self.stats.demo_moves = 0
self.stats.total_moves = 0
self.stats.quickplay_moves = 0
self.stats.goto_bookmark_moves = 0
self.stats._reset_statistics()
def __storeMove(self, am):
if self.S_DEAL <= self.moves.state <= self.S_PLAY: