It's finished! (Only with terminal interface)
In order to play, just downlad this and type python play.py
I was inspired by how many Model-View-Controller are around us in our software engineering life.
I've decided to make a tic-tac-toe game with MVC design.
I hope this helps people who is trying to learn MVC. Though this might not be a perfect MVC structure, but I'd like to think it has some resemblance of MVC strcuture.
I will start comment/documment files so that people can understand the purpose of certain files.
For me, it was funny that one file tic-tac-toe game, which only resulted in 130 lines of code can be "bloated" into hundreds line of code. But, if you think about it, it's good for extensibility while sacrificing the number of lines.
Disclaimer: I'm not so good at naming at functions and class, whic resulted in confusing and repeated names such as grid
and board
. I should fix it in the future. But now wheeeee.
- Document all of them classes.
- Safety measures for dubious input and better view organization.
- Uncoupling of
board.py
error message into view. - Better exceptions (Such as invalid user input)
- Better handling of empty string.
Honestly, if you want to go through the project, this is the recommended route.
- Start with
space.py
andutils.py
- It explains a single space of grid and
utils.py
helps withenum
classes
- It explains a single space of grid and
- Then go onto
grid.py
.- Grid is depended on with both
board.py
andrule.py
- Grid is depended on with both
- There isn't anything special with
Controller/
orView/
Honestly, this is a very simple program.