A Tic-Tac-Toe is a 2 player game, who take turns marking the spaces in a 3x3 grid.The player who succeeds in placing three of their marks in a horizontal, vertical, or diagonal row wins the game.
Tic-Tac-Toe.py is the python implementation of the game. There are two modes to play:
- Single Player (Against Computer)
- 2 Players
The 2 players mode iteratively takes input from both the players, while making sure, if anyone has won or not. Below is a snippet of the 2 Players gameplay.
The single player mode uses MiniMax algorithm to make the computer unbeatable. Even if the player plays the most optimal move everytime, the end result would be atmost a draw. The gameplay of Single Player mode is show below.Every time you make a move, the computer plays automatically.
Minimax is a decision rule used in decision theory, game theory, statistics and philosophy for minimizing the possible loss for a worst case (maximum loss) scenario. Originally formulated for two-player zero-sum game theory, covering both the cases where players take alternate moves and those where they make simultaneous moves, it has also been extended to more complex games and to general decision making in the presence of uncertainty. Free to use and re-distribute.Originally implemented in python by Vineet Joshi, @vineetjoshi253.