Tic-tac-toe is one of the most famous strategy games in the world. It's played by two players on a three-by-three board. Each of them aims to win by marking three squares in one line with the same symbol - X or O. This application is an implementation of this game and allows you to play with your friends without using paper and pencil.
🚀 Live demo: https://lszymanski7-tic-tac-toe.netlify.app
The game is played on a three-by-three board. Two players take turns marking empty squares with their symbol - X or O. In each game, the first move belongs to a different player to even the odds of winning. If one of the players marks three squares in a line with his symbol, that player wins. The game also ends when all the squares are marked and no one has a winning combination (Fig. 1.) - then it's a draw.
- Changing the starting player after each completed game.
- Highlighting a player's turn in red (X or O).
- Displaying an animation when someone wins or it's a draw.
- Counting the game score and resetting it after refreshing the page.
- Saving data to localStorage.
- Toggling between light and dark theme.
All technologies and tools were used in the latest version at the time of creating this project.
Note Download Node.js installer.
This project was created with the Node.js (v18.9.0) runtime environment and the NPM (v8.19.1) for package management. Use the Node.js installer to install both of them on your system.
Follow all of the steps below to get a local copy of the project and install any dependencies required to run it.
- Clone the repository.
$ git clone https://github.com/lszymanski7/tic-tac-toe.git
- Navigate to the project directory.
$ cd tic-tac-toe
- Install all dependencies.
$ npm install
To run the application, you must first create a production build. Use the command below for this purpose.
$ npm run build
The next command starts the server built with Node.js and Express. All static files generated by webpack will be served from the ./build
folder. The application will be launched at the following url: http://localhost:3000
$ npm run start
Any contributions are greatly appreciated. Use the issue tracker if you want to report bugs, request a new feature or improve documentation. Please check for existing issues before you report them yourself.
You can contribute by following these steps:
- Fork this repository on GitHub.
- Clone the forked repository to your machine:
$ git clone https://github.com/username/tic-tac-toe.git
- Create a new branch:
$ git switch -c <branch-name>
- Make necessary changes and commit them.
- Push changes to GitHub:
$ git push origin -u <branch-name>
- Submit a new Pull Request on GitHub.
This project is licensed under the terms of the MIT License.
If you have any questions or suggestions, please send me an e-mail.
You can also find me on the following websites: