# 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 simple AI to the Tic-Tac-Toe Game:

## 3 modes:
- Player vs. Player (2 - player mode)
- Player vs. AI (1 - player mode)
- AI vs. AI (*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 <kbd>Run</kbd>!


## *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)


## DEMO:
#### The board will be printed out every time a player makes a move.
The board will look like this!
The positions of this 3 x 3 board is same as the **keypad on the right side of your key board**.


#### You just have to input the position(1-9).
![1](https://user-images.githubusercontent.com/61280281/81096720-799abc80-8f24-11ea-97cc-de65614cbd92.png)
  
  
# *Author*:
- [Tushar Nankani](https://github.com/tusharnankani)  (tusharnankani, tusharnankani3@gmail.com)
- [Github](https://www.github.com/tusharnankani)
- [LinkedIn](https://www.linkedin.com/in/tusharnankani)
