Implemented in Python & Pygame. It consists of noughts and crosses or Xs and Os and is a paper-and-pencil game for two players, X and O, who take turns marking the spaces in a 3×3 grid. The player who succeeds in placing three of their marks in a horizontal, vertical, or diagonal row wins the game.
To use this project.
- Install dependencies & export environment variables.
$ sudo -H pip3 install -r requirements.txt
- Start project using
$ python3 game.py
- Add a file structure here with the basic details about files, below is an example.
.
├── assets.py
├── config.py
├── game.py
├── images
│ ├── CROSS.png
│ ├── logo
│ │ └── tictactoe.png
│ ├── NOUGHT.png
│ └── screenshots
├── LICENSE
├── README.md
└── requirements.txt
3 directories, 9 files
No | File Name | Details |
---|---|---|
1 | assets.py | used for loading image files in python. |
2 | config.py | contains game's configuration settings. |
3 | game.py | contains tic tac toe game's logic. |
4 | images/ | contains image resources used in the game. |
5 | images/logo | contains logo used in the README. |
6 | images/screenshots | contains game screenshots. |
7 | LICENSE | this project uses MIT License. |
8 | requirements.txt | contains all the dependencies used in the game. |
- Code Style
In order to maintain the code style consistency across entire project I use a code formatter. I kindly suggest you to do the same whenever you push commits to this project.
The python code formatter I chose is called Black. It is a great tool and it can be installed quickly by running
sudo -H pip3 install black
or
python3.6 -m pip install black
It requires Python 3.6.0+ to run.
- Usage
black {source_file_or_directory}
For more details and available options, please check their psf/black.
I also use isort, it is a Python utility / library to sort imports alphabetically, and automatically separated into sections. It provides a command line utility which can be installed using.
sudo -H pip3 install isort
- Usage
isort {source_file}.py
For more details and available options, please check their timothycrosley/isort.
- Close Issues
Close issues using keywords: how to ?
- PyGame Documentation : Pygame is a cross-platform set of Python modules designed for writing video games. It includes computer graphics and sound libraries designed to be used with the Python programming language.