Requirements
Introduction
First game to include in a suite of games. The objective of this game is to revise HTML/ JavaScript/ CSS and Gaming Algorithms.
Demo
Game will be shown here.
X:O:
Ready. X to move.
Screen
Screenshot
Below is the screenshot of the game.
Screen Content
- Screen shows the following components:
- Tic-tac-toe board
- Settings panel
- Buttons panel
Tic-Tac-Toe Board
- Board allows X or O to appear in an empty cell
- If a user tries to enter a token in an occupied cell, the following happens
- Warning sound is made
- Background to the cell goes red
- A winning number of joint tokens makes the cells goes green, and all further input is stopped
- The last token placed has its background set to yellow
Settings Panel
Player 1 and Player 2
- Player 1 and Player 2 has the following values in the dropdown:
- Human
- Computer - Hopeless
- Computer - Clever
- Human Player 1 and Player 2 means that the games waits until that individual places a token in an empty cell on the board
- A setting with Computer in the prefix means that a token is placed automatically in the board, before the other player can make their move.
- Computer - Hopeless has an algorithm where the next token is placed in a random cell.
- Computer - Clever has an algorithm where the best move is calculated.
- The Player 1 and Player 2 dropdowns are disabled once the first token is placed in a cell
- The Player 1 and Player 2 dropdowns are enabled when the game first appears
- The Reset Game Button sets the Player 1 and Player 2 dropdowns.
Select Token
- A dropdown under each player allows them to choose either X or O
- The dropdowns cannot have the same value at the same time
- The dropdowns are disabled once the first token is placed on the board
- The Select Token Dropdowns are enabled when the game first appears
- The Reset or New Game Buttons enable the Select Token dropdown
Moves
- The Moves text is disabled
- The Moves text is reset to Zero when Reset or New Game buttons are pressed.
- The Moves text for each Player increments by 1 when they place a token on the board.
- The minimum value for the Moves text is 0 and 3.
Score
- The Scores are 0 for Player 1 and Player 2 when the game first appears
- The Reset Button resets the Scores for Player 1 and Player 2 to zero
- When a Player wins the Score is incremented by 1
- When there is a Draw the Score remains the same
Buttons Panel
- Reset Game button has the following behaviour:
- Sets Player 1 to be Human
- Sets Player 1 to be Human
- Leaves the token per Player 1 and Player 2 as it was
- Resets the Moves to be zero
- Resets the Score to be zero each
- New Game button has the following behaviour:
- Leaves Player 1 dropdown the same
- Leaves Player 2 dropdown the same
- Leaves the Player Token the same
- Resets the Moves to be zero
- Leaves the Score the same