![]() These would be better as attributes for the game instance that the methods then refer back to. You would then need to write a function that walks through that dictionary and turns it into a Player object.ģ.) The reason I think you should use more classes other than semantic organization is that some of your functions have data, like symbols and max_columns in the function make_rows(). The others would save it in a human readable and editable file but they would load and save dictionaries. I have not used pickle but that should be able to save your Player class objects. The general flow of using these is pretty simple. Pickle, JSON, TOML would probalby do the trick. Deal with input validation / self explanatory (stuff like your get_pos_int)Ģ.) Decide on a data format for your player saves. ![]() ![]() Deal with the game display / Optional could be rolled into 2.Deal with game logic / create rows, handle balance changes and calculations etc.Deal with player data / create, pull up, set as active player for the game etc.Print(f"You've played a total of game(s).")īet_choices = ġ.) You should make more classes to separate functionality in meaningful ways.įrom a quick glance, here I would separate the functions into three or four groups. If get_bool("Start New game or Continue existing game? (n / c): ", "n", "c"):
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |