A web and command line app for playing Tic Tac Toe against a computer. The computer can only win or tie. This project is built in python and javascript. The computer plays a perfect game by following the Tic Tac Toe strategy described in Wikipedia. This program uses rules rather than the minmax algorithm to determine the best move.
This project uses Flask as a lightweight web framework for receiving and respodning to API requests. The front-end uses Backbone to keep the javascript organized and LESS. You'll see that what little data there is, is persisted using SimpleCache (not meant to be used in production).
To install this project, run the following from your terminal:
$ git clone https://github.com/rayvace/tictactoe
Next you'll want to run the following:
$ cd tictactoe
Next, install virtualenv
$ pip install virtualenv
$ virtualenv venv
$ source venv/bin/activate
Finally, you'll want to install Flask
$ pip install Flask
Optionally, you can install less if you plan on making updates to the CSS.
$ npm install less
To start the server locally run the the code below from the command line and visit http://127.0.0.1:5000/ in Chrome:
$ python app.py
The figures below illustrate what you should see in your browser:
If you're a fan of the terminal, you can also play from the command line by running the following:
$ python main.py
You can run unit tests for this project by running the following from the directory above tictactoe:
python -m unittest tictactoe.rules.test