This is a simple implementation of the classic game Tic Tac Toe. It is part of the curriculum for The Odin Project's JavaScript course.
You can play the game online here.
- Two players can play the game (X and O).
- Players can take turns marking spaces on a 3x3 grid.
- The game ends when a player gets three in a row or all spaces are filled without a winner.
- The winner is displayed at the end of the game.
- The game keeps running and calculating points.
- It supports single player so you can play against a computer.
- The computer uses a simple algorithm that takes all the available moves, then loops twice. First, it tries each move and plays it if it's a winning move; otherwise, it goes to the next move. Second, if there is no winning move, it tries each possible move and plays there if it's preventing the opponent from winning; otherwise, it chooses a random place to play.
- It has a mobile-first responsive design, using Bulma.io.
Here are some screenshots of the Tic Tac Toe game:
You can play the game online here.
To run this program locally, you can clone the repository to your local machine using the following command:
git clone https://github.com/i4pg/tic-tac-toe.git
Then open the index.html
file in your web browser to start playing the game.
Contributions to this project are welcome. To contribute, follow these steps:
-
Fork this repository.
-
Create a new branch with your changes:
git checkout -b my-new-branch
-
Make your changes and commit them:
git commit -am 'Add some feature'
-
Push your changes to your forked repository:
git push origin my-new-branch
-
Create a pull request on this repository.
This project is licensed under the MIT License. See the LICENSE file for details.