X always goes first. If a player is able to draw three X or three O in a row, that player wins. If all nine squares are filled and neither player has three in a row, the game is a draw.
Html, CSS, javascript, jQuery
When you press on a cell, javascript turns the ID of the cell into a row an a stroke which are saved into the array. Array is basically a matrix. All calculation is based on matrix.
Crossing line appears on screen when there are 3 Id's in row, stroke or diagonal line.
I used different Audio() functions to use different sounds for wins, draw and restart button.
Here is the TicTacToe Combat
- Popping windows on a win etc...
- Animation, when moving cursor
- More sound effects
- Firebase option
- AI player
- Scores and history of players
- Naming players
- and more...