The classic game of Tic Tac Toe written in JavaScript
Tic-Tac-Toe is a two-player game in which the players fill up nine empty rectangles in a table with either an X or an O when it is their turn. Once someone succeeds in lining up 3 consecutive signs of the same kind vertically, horizontally, or diagonally, that player wins.
Click anywhere on the 3 x 3 grid to start playing by setting the cell in the grid to either X or O. The game ends when the conditions given above are reached.
There is a multiplayer option as well as an option to play against the computer (I bet you will find it very difficult to beat it 🙂).
Note: You make the first move as X against the computer (when played in Player vs Computer mode).
I tried to make the game a little different by adding a 4 x 4 version. The only difference being you need to get 4 consecutive Xs or Os horizontally, vertically, or diagonally.
you can find the app here 👉 https://jeswin-8802.github.io/tic-tac-toe/
Have Fun! 👍
- https://codepen.io/ (dynamic background css)
- https://www.codebrainer.com/blog/tic-tac-toe-javascript-game (this article explains the step-by-step creation of a basic tic tac toe game)
- https://playtictactoe.org/
