Learning to code with Tic Tac Toe

in coding •  5 years ago 

Even thought my original reason to write this article is to dissect the game tic tac toe to learn about different aspects of coding. I realize this will require a full day and plenty of research and analysis to dissect the games to learn what Tic Tac Toe will teach you over different iterations.

So instead I will just give my initial ideas and if you have something I haven't thought about? Feel free to comment. Also, if you think some other game like Tetris or Sodoku will teach you something greater, also feel free to comment.

Another reason I am plugging this article is to show different levels of coding the tic tac toe game. Starting from a console, to a desktop to a web-like version on the Jupyter Notebook version. Unfortunately no Django or flask version as these are mainly backend framworks and Python frontend frameworks like Pyjamas or PyJS.

Console tic tac toe tutorial

Desktop version of Tic Tac Toe

Jupyter Notebook version of Tic Tac Toe

Unfortunately I couldn't find a proper video in Kings language, so will use this one in spanish. If you have any questions just use the comments.

So what did we learned?

To start, we learned how to use triggers or signals which are things that will act upon a certain situation happens. So if one player win, we will display a winner, vs if the current user loose will display a different message.
We also learned how to build functions and classes and how to break down our actions into different functions. We also saw how 3 different developers applied logic differently in the whole coding aspect as well as how is divided as the more demanding it gets. For example, a console coder wont need nearly as many libraries as a Desktop one. Same with a user already in an environment like Jupyter.
Eventually you will see some similarities as far as the use of widgets and how they relate to one another, giving the developer some sense of how much from the framework itself he most learn. Pre-fabricated objects to call and how to modify them for his goals.
Some practices like commenting your code are also mentioned as well as having a good segmentation of code even if it can all go into one file. Making it easier to debug in the future.

Finally you can start thinking how you can extend this program to do more, maybe have a whole tournament in Tic Tac Toe among your friends and extend it to do some network programing via sockets. Or making the game more complex and jump to a Sodoku type level.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!