Tic Tac Toe Game
This is a code for Tic Tac Toe game in python.
Game has 2 difficulty levels.
- Easy
- Hard
To play the game, use this command in a LINUX terminal:
pyhton3 main.py
Game will now begin.
A Brief desciption of process of game:
- First of all, user will be asked to select his symbol; either
XorO. - Then user will be asked to select difficulty level; either
E(for EASY) orH(for HARD). - Once ready, press
Enterto start the game. - First turn will be decided randomly and then moves will be alternate.
- 3x3 game board will be displayed, each box having a unique id. As game progresses, box id's will be replaced by symbols.
- In computer's turn, wait till computer select it's move.
- In
EASYlevel, computer's move is just a random selection from all the availbale moves while inHARDlevel, computer usesMINIMAX Algorithmto find best possible move. - In user's turn, enter box id for the block you want to move. If invalid id is chosen, error message will be displayed.
Victory/Loss/Drawmessage will be printed as soon as game ends.