Right now game_state is a dict with lots of helper functions. It's a prime candidate to become a class, and those helper functions will become methods.
Implementation:
create a class GameState(object). It should have the following methods:
@classmethodload(slug)
save()
get_seed_count()
get_resource_count()
get_plot(x, y)
has_planted_crops()
initialize()
get_unlocked_plot_count()
check_password(password)
jsonify()
The dict storing the data should be private to the class (self._data = {...})
Existing code should be refactored to no longer need direct dict access.
You'll find this issue slightly easier (and will be able to take in a password in the load function) if you merge PR #74 before you start working on it.
Right now
game_state
is a dict with lots of helper functions. It's a prime candidate to become a class, and those helper functions will become methods.Implementation:
create a
class GameState(object)
. It should have the following methods:@classmethod
load(slug)
save()
get_seed_count()
get_resource_count()
get_plot(x, y)
has_planted_crops()
initialize()
get_unlocked_plot_count()
check_password(password)
jsonify()
The dict storing the data should be private to the class (
self._data = {...}
)Existing code should be refactored to no longer need direct dict access.