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

Extract a common class/struct.

This is Refactoring / code cleanup.

See:

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

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

* 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 17:59:27 +03:00
parent 18febbe240
commit 23843dc2a8

View file

@ -360,6 +360,13 @@ class GameTexts(NewStruct):
list = attr.ib(factory=list)
@attr.s
class GameHints(NewStruct):
list = attr.ib(default=None)
index = attr.ib(default=-1)
level = attr.ib(default=-1)
class Game(object):
# for self.gstats.updated
U_PLAY = 0
@ -604,11 +611,7 @@ class Game(object):
self.filename = ""
self.demo = None
self.solver = None
self.hints = Struct(
list=None, # list of hints for the current move
index=-1,
level=-1,
)
self.hints = GameHints()
self.saveinfo = Struct( # needed for saving a game
stack_caps=[],
)