This is a command-line Tic Tac Toe game with a computer opponent that uses the minimax algorithm for strategic moves.
O | X | X
---------
O | O | O
---------
X | | X
Sorry, You Lose!
________
< Loser! >
--------
\ ^__^
\ (xx)\_______
(__)\ )\/\
U ||----w |
|| ||
- Play against a computer opponent.
- The computer uses the minimax algorithm to make optimal moves.
- Simple text-based animation for win, lose, and draw scenarios.
-
Ensure you have Node.js installed on your system.
-
Clone this repository:
git clone <repository-url>
cd <repository-folder>
-
Install Dependencies:
yarn
or
npm install
-
Start the game:
yarn play
or
npm run play
or
node index.mjs
You will play as "X," and the computer will play as "O." The game board is a 3x3 grid.
To make a move, enter your desired row (0-2) and column (0-2) separated by a space. For example, to place your "X" in the top-right corner, you can enter "0 2."
The computer will respond with its move, and the game will continue until one player wins, or it's a draw.
The game will display a text-based animation for win, lose, or draw scenarios.
Make the first move
| |
---------
| |
---------
| |
Player X, enter row (0-2) and column (0-2) separated by a space:
Each cell is labeled with its corresponding row and column position.
0 0 | 0 1 | 0 2
-------------------
1 0 | 1 1 | 1 2
-------------------
2 0 | 2 1 | 2 2
This project is licensed under the MIT License