A web application for playing tic-tac-toe against a computer opponent (CPU) with varying levels of difficulty. Built using React.
If you're interested in the code, all CPU logic can be found at /src/logic/
.
Hard:
- Checks for a move to win the game.
- Checks for a move to stop the player from winning.
- Find the optimal win path (if multiple, it is randomly chosen from them).
- Makes random choice.
Normal: The chances on the first two checks are an attempt to simulate human error within the CPU.
- [90% chance] Checks for a move to win the game.
- [33% chance] Checks for a move to stop the player from winning.
- [100%] Find the optimal win path (if multiple, it is randomly chosen from them).
- [100%] Makes random choice.
Easy:
- Makes random choice.
- NodeJS
- NPM
- Clone the repository to your local machine using the following command:
git clone https://github.com/Angoooose/tic-tac-toe-v2
- Execute
npm install
to install the needed NPM packages. - Execute
npm start
, this should open the application in your browser atlocalhost:3000
.