Tic Tac Toe
This is a Tic Tac Toe game that I made for my Project Zero, as part of my Web Development Immersive 16 with General Assembly.
The game is played on a grid that has 3 squares by 3 squares. The choice is between player one i.e.. "X" and second player "O". Players take turns putting their marks in empty squares. The first player to get 3 of her marks in a row (up, down, across, or diagonally) is the winner.
How to view
Play it here
Steps for making the brain and connecting it to bones and skin :
- make click event
- make win sequence array
- make two empty arrays for pushing the values of clicks from playerOne and playerTwo.
- make function for winning
- Function to find the winner.
- Function for the elementPressed in the table. Following were included in the function:
- check if its player one or player two (by using mod operator).
- push value in the respective empty player arrays. - push command.
- called function () "findWinner in the if statement and sort it in ascending order by using sort() method for comparison"
- Function for resetting the board & new game. the main difference between the two is when new game is clicked it resets games won counter.
Thanks for stopping by, and I hope you enjoy the game!