Skip to content

Instantly share code, notes, and snippets.

@featherart
Created October 8, 2013 00:29
Show Gist options
  • Save featherart/6877509 to your computer and use it in GitHub Desktop.
Save featherart/6877509 to your computer and use it in GitHub Desktop.
javascript for tic-tac-toe
// name_of_obj.name_of_key_in_object => value_associated_with_that_key
var board = [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
];
// Variable to store the winning player.
var winningPlayer= 0;
// Keeps track of whose turn it
var turn = {
number : 0,
current_player_color : function() {
},
change_turn : function(){
}
};
// Checks to see if any of the rows has 3 in a row
function check_rows() {
}
// Checks to see if any of the columns has 3 in a row
function check_cols() {
}
// Checks to see if any of the diagonals has 3 in a row
function check_diag() {
}
// Checks to see if either player has won, alerts the winning player if so, and disables further gameplay
function check_winner () {
}
$(document).ready(function(){
// takes the appropriate action when a box is clicked
$('.box_cell').click(function(){
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment