Create a JavaScript class that, when instantiated, draws a playable tic-tac-toe game in your browser!
- Create a class using a
function
definition and aprototype
object. - Use jQuery to enable & manage interactions in the
DOM
. - Use one markup file, one stylesheet, and one JavaScript file for your solution.
- The game is played on a 3x3 grid.
- Each player, in turn, selects one available grid spot
- Upon selecting (clicking), the spot is marked as belonging to that player
- If a player claims three spots in a row (horizontally, vertically, or diagonally), they win!
- It is possible (even likely) that games can end in a draw.
- Add a single player mode where, after taking your turn, the computer (JavaScript)...
- Selects the first available spot OR
- Randomly selects a spot OR
- Picks the "best" spot (whatever best means)
- Add a new game button that resets the board, allowing a fresh game to be played.
- Keep track of wins and losses for both players, updating the counts whenever a game ends.