Closed smithandrewl closed 5 years ago
Thanks a ton @smithandrewl !!
That is complete overhaul of the project, I am currently reviewing your pull request and will get back to you soon :)
Fantastic Job @smithandrewl !! :100: I am so happy with the outcome, hats off to your efforts. :) You made this project highly readable and friendly for future contributors, now finally I can think of adding in new features, all thanks to you, changes looks good to me, merging in your awesome PR.
Thanks again !! :+1:
This should address #2
This change creates the following main classes ConnectGame GameBoard GameData GameRenderer
ConnectGame is created by game.py and contains the logic for the game. GameBoard contains holds data for the game board and contains methods to operate on it GameData contains all of the game data (including a GameBoard instance) GameRenderer "renders" the game data object by drawing to the screen and playing audio.
game.py creates the ConnectGame and only processes mouse and keyboard input, delegating to the ConnectGame object.
An external library, event_bus is used to dispatch events from one place and listen for them in another place. It allows the ConnectGame class to notify the GameRenderer class to do something without having to tightly couple them together.
I also added type hints (https://docs.python.org/3/library/typing.html) to most variables. This allows the editor that I use (PyCharm) to notify me if I put a string where an int should be.
I also ran black and isort.