Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tusharnankani/Tic-Tac-Toe-AI

Adding AI to the Tic Tac Toe Game
https://github.com/tusharnankani/Tic-Tac-Toe-AI

artificial-intelligence game python terminal-based tic-tac-toe

Last synced: 3 months ago
JSON representation

Adding AI to the Tic Tac Toe Game

Awesome Lists containing this project

README

        

# Tic-Tac-Toe-AI

[![Run on Repl.it](https://repl.it/badge/github/tusharnankani/Tic-Tac-Toe-AI)](https://repl.it/github/tusharnankani/Tic-Tac-Toe-AI)

Adding a AI to the original Tic-Tac-Toe Game.

![](https://media.giphy.com/media/3oriNKQe0D6uQVjcIM/giphy.gif)

Not this, but something much simpler. A CLI based Tic Tac Toe built from scratch.

## *Live Demonstration*

- You can view it on the live terminal by clicking on the `repl.it` badge above,
- Or you can view it [here](assets)

### *Features*:

* Player vs. Player
* Computer vs. Player
* Computer vs. Computer (*just for fun*)

### To view this project on a live terminal:

- Click [here.](https://repl.it/github/tusharnankani/Tic-Tac-Toe-AI)
- And then, click on Run!

#### NOTE - View [GamesBuiltUsingPython](https://github.com/tusharnankani/GamesBuiltUsingPython) to see other Python projects.

### *To run it on your PC*:

* Make sure you have Python 3.7.x or Python 3.8.x installed, if not, click [here](https://www.python.org/downloads/) to install!
* Clone this into your Desktop: `git clone "https://github.com/tusharnankani/GamesBuiltUsingPython"`
* Open Command Line or Terminal
* Change directory to a respective game: `cd "Desktop\Tic-Tac-Toe-AI"`
* Run : `python tic-tac-toe-AI.py`
* And now have fun! ^_^

![gif](https://media.giphy.com/media/KoTuTfaOTZ38tykJQv/giphy.gif)

## *References*

#### *Logic*

- Optimal Tic Tac Toe Moves

![tic_tac_toe](https://user-images.githubusercontent.com/61280281/91558896-ba479700-e954-11ea-8415-3759e555ad23.png)

- Videos:
- [Tic Tac Toe - Never Lose (Usually Win)](https://www.youtube.com/watch?v=5n2aQ3UQu9Y&feature=youtu.be)
- [Tic Tac Toe AI with Minimax Algorithm](https://www.youtube.com/watch?v=trKjYdBASyQ&feature=youtu.be)
- [Minimax Algorithm in Game Theory](https://www.geeksforgeeks.org/minimax-algorithm-in-game-theory-set-1-introduction/)
- [Algorithms Explained – minimax and alpha-beta pruning](https://www.youtube.com/watch?v=l-hh51ncgDI)