Skip to content
Tic-Tac-Toe project @ General Assembly
JavaScript CSS HTML
Branch: gh-pages
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
Sword Swing-SoundBible.com-639083727.wav
Swords_Collide-Sound_Explorer-2015600826.mp3
index.html
jQuery.js
main.css
main.js
tic-tac-toe-o.jpg
tic-tac-toe-x.jpg

README.md

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.

Libraries

  • jQuery
  • sweetalert

Features

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

Fork

Approach

The game is structured keeping in mind the analogy , Html(Bones) and css(skin) and JavaScript(brain) :

Steps for making the brain and connecting it to bones and skin :

  1. make click event
  2. make win sequence array
  3. make two empty arrays for pushing the values of clicks from playerOne and playerTwo.
  4. make function for winning
  5. Function to find the winner.
  6. Function for the elementPressed in the table. Following were included in the function:
    1. check if its player one or player two (by using mod operator).
    2. push value in the respective empty player arrays. - push command.
    3. called function () "findWinner in the if statement and sort it in ascending order by using sort() method for comparison"
  7. Function for resetting the board & new game. the main difference between the two is when new game is clicked it resets games won counter.

Helpful Resources

Thanks for stopping by, and I hope you enjoy the game!

You can’t perform that action at this time.