This is a simple Tic-Tac-Toe game built with Next.js and TypeScript. It features a board where players can make moves, and an AI (using the Minimax algorithm) that can play against the user. The game also tracks the state of the game, including wins, draws, and player turns.
- Human vs AI: Play against an AI that uses the Minimax algorithm to make decisions.
- AI Difficulty: Easy, Medium and Hard levels. The AI plays optimally.
- Game State: The game tracks the moves made by both players and can determine the winner or declare a draw.
- Game Reset: Players can restart the game at any time.
- Responsive Design: The game is designed to work on both desktop and mobile screens.
- The game begins with the player making the first move as "X".
- The AI takes its turn, making optimal moves based on the Minimax algorithm.
- The game continues until there is a winner or the game ends in a draw.
- Players can click on any empty cell to make their move.
- The game can be reset at any time using the RESET GAME button.
- Displays steps played in
Asc
orDesc
order - Allows time travel to previously played steps
To get started with this project, follow the steps below.
- Node.js (version 14 or higher)
- npm (or yarn)
-
Clone the repository:
git clone https://github.com/amarachigoodness74/tic-tac-toe-with-ai-player.git cd tic-tac-toe-with-ai-player
-
Install dependencies:
Using npm:
npm install
Or using yarn:
yarn install
-
Start the development server:
npm run dev
Or using yarn:
yarn dev
The app will be running on
http://localhost:3000
.