This project is a simple tic toc toe game using Finite State Machine
This is a game normally played with paper and pencil and often called noughts and crosses. The game is played on a 9-box grid and each player selects their mark as X or O They take turns placing their mark in one of the 9 boxes and the first to achieve three in a row wins. Three in a row can be hirizontal, vertical or diagonal. Its common that no-one wins and that is a Tie game.
Supports 2 players Supports 2 levels of difficulty for computer opponent =======
python src/run_script.py
make test
Instead of a game loop, just for fun the implementation uses a finite state machine to switch between player turns. StartState -> TurnState -> EndState ->StartState
Change the display to use Raspberry Pi SenseHat and txt output - Done Change the display to use tkinter Add db to provide high score history
Warning
I used pyenv 3.9.0, this takes 20mins to recompile during installation on raspberryPi 3. It required
sudo apt-get install python-scipy
sudo apt update
sudo apt install libatlas-base-dev
sudo apt install libopenjp2-7 sense-hat
pip install sense-hat rtimulib
python src/run_scripts.py
- Buy a sense hat and plug it into the raspberry pi when its switched off
- Update raspberry pi O/S sudu apt update
- install sense hat sudo apt install sense-hat
- reboot sudo reboot
- Sense hat examples can be found here '/usr/src/sense-hat/examples'
- More sensehat info https://pythonhosted.org/sense-hat/
Upgraded to python 3.9.0 because tk would not work with earlier versions Sense hat didn't work with 3.9.0, install RTIMULib manually to fix this git clone https://github.com/RPi-Distro/RTIMULib Follow README.md on building and installing it