Classic Tic Tac Toe game coded in Python.
This is a command-line implementation of the classic game, Tic Tac Toe, written in Python.
Table of Contents:
- Installation
- Gameplay - Rules
- Modes
- Playing Against the Computer
- Technologies Used
- Contributing
- How to reach me
For playing you need to:
1- Download the code from this repository.
2- To play this game, you'll need to have Python 3 installed on your machine. If you don't have it, you can download and install it from the official - Python website: https://www.python.org/downloads/
3- Run main.py in VSC, Pycharm, etc. or open it in console.
The game automatically saves your progress in a database, you can check your stats at any time.
The game is played on a 3x3 grid, with two players taking turns marking spaces with either an "X" or an "O". The first player to get three of their marks in a row, either horizontally, vertically, or diagonally, wins the game. If all nine spaces are filled without either player getting three in a row, the game ends in a tie.
There are three difficulty modes to choose from:
- Easy
- Medium
- Hard
- There is also a two-player mode that allows two human players to play against each other.
When playing against the computer, the game uses an artificial intelligence (AI) algorithm to determine the computer's moves. The difficulty level of the AI can be adjusted by selecting a mode before starting the game.
This game was written in Python 3, and makes use of the following modules:
- time: Used for a short pause between moves to make the game feel more natural.
- secrets: Used to generate random AI moves in the easy and medium difficulty modes.
- sqlite3: Used to save scores in a database based on player's name.
This project is open for contributions from anyone who wants to improve it. If you'd like to contribute, feel free to fork the repository, make your changes, and submit a pull request
Enjoy it!
karpo27