Skip to content

This repository contains a self-initiated project where I created a Tic-Tac-Toe game via Python's Tkinter library with the guidance of external sources. This projects helps me to further my Python skills, object-oriented programming concepts, and app and user interface development.

Notifications You must be signed in to change notification settings

nlawira/tic-tac-toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Tic Tac Toe Game

Project Overview

This project was modeled after RealPython's tutorial on creating a Tic Tac Toe game using Python's Tkinter library, which can be found in this link (Pozo Ramos & Real Python, 2022)! This project aims to:

  • Implement the Tic-Tac-Toe game using object-oriented programming principles to ensure the code's modularity, reusability, and maintainability.
  • Improve proficiency in Python by applying OOP concepts such as classes, objects, inheritance, encapsulation, and polymorphism.
  • Design a simple and intuitive user interface to interact with the game via Tkinter, ensuring ease of use and a smooth user experience.
  • Perform thorough testing to identify and fix bugs, ensuring the game operates correctly under various scenarios.
  • Share the project on GitHub to showcase programming skills and project work to potential employers, peers, and the wider programming community.

The game created follows the conventional Tic-Tac-Toe game rules, which can be referred to through this link (Tic Tac Toe | Exploratorium, 2023). It is currently only playable in the 3 by 3 sized grid with two human players. Improvements to the projects will be made soon, which include introducing a selection of varying sizes (e.g. 4x4, 5x5) and the ability to play against a computer program.

Game Logic and Algorithm

  1. The code initiates as an executable program and instantiates game and board variables from the TicTacToeGame and TicTacToeBoard classes, respectively.
  2. The board and grid are displayed, and the game algorithm waits for input from the players.

Start Screen

3. The players take turns clicking the grids where they want to place their X/O marks. After every click, the algorithms register the marked grid's coordinates and label the grid with the respective player's mark.

Player X's Turn Player O's Turn

4. Afterward, it searches through a list of winning combinations, 3 in a row either horizontally, vertically, or diagonally, and checks whether the current grid fulfills any of them. If it does not, it checks whether the grid is entirely filled. If it is, then the game is tied. Otherwise, the turn passes on to the next player.

Win Screen Tied Game

5. After the game is over, players can reset or exit it by selecting it from the menu bar at the top right.

Menu Bar

References

  1. Pozo Ramos, L. & Real Python. (2022, June 27). Build a Tic-Tac-Toe game with Python and Tkinter. Retrieved May 20, 2024, from https://realpython.com/tic-tac-toe-python/
  2. Tic Tac Toe | Exploratorium. (2023, April 4). Exploratorium. https://www.exploratorium.edu/explore/puzzles/tictactoe

Contact me

Thank you so much for visiting my repository! I sincerely hope my project can help you in providing insights to regression analysis, machine learning models, and report writing! 😄 If you would like me to explain my project further or contact me for any reason, you can email me below or connect with me on LinkedIn!

LinkedIn Email

About

This repository contains a self-initiated project where I created a Tic-Tac-Toe game via Python's Tkinter library with the guidance of external sources. This projects helps me to further my Python skills, object-oriented programming concepts, and app and user interface development.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages