Tic-Tac-Toe game (also known Noughts and Crosses), is a paper-and-pencil game for two players, X and O, who take turns marking the spaces in a 3×3 grid. The player who succeeds in placing three of their marks in a horizontal, vertical, or diagonal row is the winner.
This project is an upgraded version of the project tic-tac-toe in java which allows a human being to play against a computer in implementing three level of difficulty by integrating artificial intelligence.
- easy : Make a random move
- medium : It uses this technique
- If it can win in one move (if it has two in a row), it places a third to get three in a row and win.
- If the opponent can win in one move, it plays the third itself to block the opponent to win.
- Otherwise, it makes a random move.
- hard : We implement the Minimax algorithm. It's a brute force algorithm that maximizes the value of the own position and minimizes the value of the opponent's position. It's not only an algorithm for Tic-Tac-Toe, but for every game with two players with alternate move order, for example, chess. Thus, this level is an undefeated champion (so, it can come out with a win, or a tie score).
There is another feature in this app: if you're tired playing the game, you can even launch a match between two ai and watch them playing.
Since it's not yet in GUI, you might use these coordinates to play the game.
To start the game, after input command: type for instance start hard user which mean match between aiPlayer (computer) and human.