Time to put your knowledge of Javascript and jQuery to the test!
Enclosed you'll find an already made tic-tac-toe board. Your job is to make the game actually work using Javascript and jQuery.
- You can add as many
class
andid
attributes as you need to the HTML - jQuery has already been added
- Don't worry about CSS, just make the game work!
Here are the user stories:
Gameplay:
- When the page loads, Player 1 (X) is the first player to go
- When Player 1 clicks an empty cell, it should be marked with an "X", and
Current Player
should switch to two - When Player 2 clicks an empty cell, it should be marked with an "O", and
Current Player
should switch back to one - If a player clicks a cell that has already been marked, they should see an alert letting them know that the cell in question has already been taken
Winning:
- When a player gets three in a row in any direction, the board should should be wiped clean, and that player's score should be incremented
- The game should then start over with the losing player getting to go first
No game is complete without some kind of easter egg. Add a cheat code, or something along those lines to make the game more interesting!
All content is licensed under a CCBYNCSA 4.0 license. All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact [email protected].