by Matt Cameron
A game project briefed by General Assembly, written in javascript.
The game has several bonus features included:
This Tic Tac Toe game has three different game options:
Standard Tic Tac Toe game between two users. Players alternate turns, selecting a square to insert their game piece (either 'X' or 'O').
Players attempt to line up three of their game pieces in a row, in any direction, while preventing their opponent from doing the same.
Once a player lines up three pieces in a row, the game is over.
If all squares are used and neither player has won, a tie is declared.
In this mode, players have only three seconds to make each move.
If a move has not been made within this time, the player forfeits his turn and the opposing player can play another piece.
Players can also opt to play versus the computer.
This one player game allows you to still enjoy Tic Tac Toe, even if you have no one to play with!
Every time a game is won, the scoreboard is updated, so that you can keep count of the all-time score. This score will persist across browser sessions, and cannot be reset.
If you abandon a half-finished game (either because your cat is stuck in a tree, or you accidentally navigate away), when you reload the game, you will be given the option to resume your previous game.
Alternatively, you can simply start a new game as per usual.
Once a game is over, you can wipe the board clean and start a new game.
Pro-tip: You can also use this if you are a bad loser, and your chances of winning aren't looking good. ;)
If you ignore the warning and click the button in the bottom right hand corner, well... don't blame me.
This project was built from scratch and heavily utilises jQuery for easy access and manipulation of the DOM.
It was built as simply as possible to begin with, and I have continually added features over time. As additional game modes were added, the code has become considerably busier.