Hi, I have uploaded the codes of simple game developed using HTML, CSS, JavaScript.
//Game We have 9 boxes in a matrix shape. and we have 2 players
- We have 2 symbols known as "X" and "O"
- Any player can choose any symbol when he/she starts playing the game.
- Suppose player 1 chooses "X" and puts in a box and player 2 chooses "O" and puts in another box and so on.
- Whenever any horizontal/ vertical or diagonal row/column gets filled by same symbol by any player than that player wins the game.
- Hence they are some winning patterns to actually build this game.
Imagine a matrix
0 1 2 3 4 5 6 7 8
winning patterns
Horizontal Patterns 0 1 2 (all 3 can X X X or O O O) 3 4 5 (all 3 can X X X or O O O) 6 7 8 (all 3 can X X X or O O O)
vertical Patterns 0 3 6 (all 3 can X X X or O O O) 1 4 7 (all 3 can X X X or O O O) 2 5 8 (all 3 can X X X or O O O)
Diagonal Patterns 0 4 8 (all 3 can X X X or O O O) 2 4 6 (all 3 can X X X or O O O)