https://github.com/yav-ai/ai-tic-tac-toe
This is a command-line Tic Tac Toe game with a computer opponent that uses the minimax algorithm for strategic moves.
https://github.com/yav-ai/ai-tic-tac-toe
ai-tic-tac-toe basic-ai cli cli-games game javascript-game minmax-algorithm minmax-algorithm-nodejs node-game nodejs nodejs-game tictactoe tictactoe-javascript
Last synced: 8 months ago
JSON representation
This is a command-line Tic Tac Toe game with a computer opponent that uses the minimax algorithm for strategic moves.
- Host: GitHub
- URL: https://github.com/yav-ai/ai-tic-tac-toe
- Owner: YAV-AI
- License: mit
- Created: 2023-11-28T02:32:43.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-28T08:18:17.000Z (almost 2 years ago)
- Last Synced: 2025-01-05T12:28:25.299Z (9 months ago)
- Topics: ai-tic-tac-toe, basic-ai, cli, cli-games, game, javascript-game, minmax-algorithm, minmax-algorithm-nodejs, node-game, nodejs, nodejs-game, tictactoe, tictactoe-javascript
- Language: JavaScript
- Homepage:
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
# Tic Tac Toe Game
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 | | XSorry, You Lose!
________
< Loser! >
--------
\ ^__^
\ (xx)\_______
(__)\ )\/\
U ||----w |
|| ||
```## Game Features
- 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.## Install the game
1. Ensure you have [Node.js](https://nodejs.org/) installed on your system.
2. Clone this repository:
```bash
git clone
``````bash
cd
```3. Install Dependencies:
```bash
yarn
```or
```bash
npm install
```## How to play
1. Start the game:
```bash
yarn play
```or
```bash
npm run play
```or
```
node index.mjs
```### User Input
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:
```### Input position reference
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
```## License
This project is licensed under the MIT License