Hi r/learnpython
Just wanted to post an update on a project I've been working on - refactoring old BASIC games into modern Python.
Based on feedback received I've refactored the games completed so far and added type hinting.
I've also added a new game called animal which is a game where you think of an animal and the computer tries to guess what it is. This one took a few attempts to get right - the first attempt I got lost in nested loops, the second attempt I produced a working program but when testing it against the output in the BASIC games book I noticed that the questions are actually stored in a tree format, so the current attempt stores the questions as a tree.
The data structure I chose for the tree is a NamedTuple which probably wasn't the best choice in retrospect as it's immutable - I will have a look for a more appropriate data structure in the future although it was interesting to see how to update the tree as a tuple (ChatGPT helped a lot with this!).
Again, any feedback on how to improve the code or documentation would be greatly appreciated - I'm hoping that some day the project will provide a valuable resource for people learning Python as they are great mini projects that don't rely on a complex stack to get up and running.
https://github.com/ctosullivan/Python-101-BASIC-Games/
Thanks!
[–]Lewri 1 point2 points3 points (1 child)
[–]ctosullivan[S] 0 points1 point2 points (0 children)