DEV Community

Tomas Guajardo
Tomas Guajardo

Posted on

Mastering Tic-Tac-Toe with Python: A Journey into Game Development

Introduction: Why Tic-Tac-Toe?

When someone, especially ME, wants to learn something, making it interesting is the way to go, as my 5-year-old is fascinated with tic tac toe creating a game about it seems like a good way to save some paper.

Brainstorming: from classical game to code.

As any good project is important to start by setting some notions down, in this case the logic of the game, winning conditions, end game conditions and how to input the player moves. This produced three classes:

  • Board
  • Players
  • Game

Each trying to be as modular and simple as possible to ensure a code readable and easy to maintain.

What's next? OH right the code.

For a detailed look please revise the GitHub:
Tic Tac Toe Game
The most interesting and, somehow, difficult part for me was the display function.
Tic Tac Toe render

Conclusion: The Learning Experience.

This was a fun project to do, it helped me internalize programming concepts that I have always overlooked.

As a funny end note, tic tac toe is known in my country as "Gato".

Top comments (1)

Collapse
 
jennydc-dev profile image
JennyDC

Post interesante :)
El enfoque modular es esencial ^^

Dos curiosidades. En Argentina, el juego es conocido Tateti ; en Italia es llamado Tris. ๐Ÿ˜Š