# 1 Introduction

## 1.1 Purpose

This specifications establishes the requirements for the product named Qheadache. The intended audience is the analyst, programmer and tester of Qheadache.

## 1.2 Scope

The product is a computerized game that displays an interface used to solve a specific headache.

## 1.3 Product overview

### 1.3.1 Product perspective

The product runs as a stand-alone application.

#### System interfaces

[N/A]

#### User interfaces

The product's user interface uses menus, graphics, and sounds. The main window shall provide a board and a menu bar.

#### Hardware interfaces

The product requires the use of a keyboard and a mouse to interface with the user. Other pointing and input devices are allowable, provided they provide similar functions to a mouse and keyboard, namely the ability to move a cursor onscreen to select buttons and the ability to type names.

The product requires a graphical display of at least 800x600 resolution. Sound is not required to play the game.

#### Software interfaces

The product uses the Qt graphical library.

#### Communications interfaces

[N/A]

#### Memory constraints

[N/A]

#### Operations

[N/A]

#### Site adaptation requirements

[N/A]

#### Interfaces with services

[N/A]

### 1.3.2 Product functions

*   The user must be able to undo and redo their last thousand actions.
*   The product must count and display the time that the user uses to play.
*   The product must count and display the number of the user's actions.
*   The product must record the score (time and number of actions) of a play associated with the name of a user.
*   The product must display a window with all the players' scores.

### 1.3.3 User characteristics

No qualification is necessary. The users consist of anyone who wants to play a simple game and knows how to operate a computer. The user can be a beginning level player starting at age 8, up through an advanced level player who could be an adult.

### 1.3.4 Limitations

[N/A]

## 1.4 Definitions

[N/A]

# 2 References

[N/A]

# 3 Requirements

## 3.1 Functions

*   **Game Board and Blocks**
    *   The board is a rectangular zone where the user can move blocks.
    *   Let x be the measure unit. The height of the board is 5x, and its width is 4x. The value of x must be between 50 and 100 pixels.
    *   The blocks are separated by a margin of 0.1x.
    *   There are four square blocks with a side of x.
    *   There are four rectangular blocks with a height of 2x and a width of x.
    *   There is one block with a height of x and a width of 2x.
    *   There is one square block with a side of 2x.
    *   The board is black and the blocks are yellow.
*   **Block Actions**
    *   **Block Selection**: When the user left-clicks down on a block, the game state becomes "Block deplacement".
    *   **Block Deselection**: When the user left-clicks up on a selected block, the game state becomes "Block selection".
    *   **Block Movement**: While in the "Block movement" state, mouse movement causes the selected block to follow the mouse. The block cannot overlap other blocks or exit the game zone. The selected block must maintain a distance of at least 0.05x from other blocks.
*   **Undo and Redo Actions**
    *   **Undo Action**: The user can cancel the last movement via a menu selection. The game displays the block positions as they were before the last movement. This action is considered a movement. The "undo" action is unavailable if there was no previous movement.
    *   **Redo Action**: The user can redo a movement that has been canceled via a menu selection. The game displays the block positions as they were before the last movement was canceled. This action is considered a movement. The "redo" action is unavailable if the previous action was not an "undo" action.
*   **End of Game Management**
    *   The game ends when the great square block (2x by 2x) is moved to the bottom of the board.
    *   When the game ends, all player statistics (time, move count) are frozen.
    *   If the player's number of movements is lower than the highest number recorded, a "Finish Window with Statistics" is displayed. Otherwise, a "Simple Finish Window" is displayed.
    *   **Finish Window with Statistics**: This window contains the text "You win ! Enter your name : ", an edit box for up to 20 characters, and an "OK" button. When "OK" is clicked, the player's statistics are recorded, the window closes, and the statistic window is displayed.
    *   **Simple Finish Window**: This window contains the text "You win !" and an "OK" button. When "OK" is clicked, the window closes, and the statistic window is displayed.
*   **Statistics Management**
    *   **Player Statistics**: The number of block movements and the time elapsed are recorded during the game. The movement count is incremented by 1 for each block movement.
    *   **Game Statistics**: The game statistics file stores up to 10 player statistics (name, block movement number, time). When a new high score is recorded, it replaces the score with the greatest number of block movements if 10 scores are already present. An error message is displayed if the file cannot be updated.
    *   **Statistics Erasing**: The user can erase all statistics via a menu selection. An error message is displayed if the file cannot be updated.
    *   **Statistic Window**: This window displays a list of up to 10 player scores, showing the player's name, number of movements, and time. It is displayed at the end of a game or via a menu selection.
*   **File Management**
    *   **Open Game**: The user can select a previously saved game file from a dialog box to load the game state and player statistics from that file.
    *   **Save Game**: Saves the current game state. If the game has been saved before, it overwrites the previous file. Otherwise, it behaves like "Save Game As...". The saved data includes current block positions, their last 1000 previous positions, the number of movements, and the elapsed time.
    *   **Save Game As**: Opens a dialog box for the user to choose a file to save the current game state and statistics.
    *   **Exit**: Stops the game. If the game is not saved, a dialog box asks the player if they want to save. If "Yes" is selected, the "Save Game" action is performed before the application closes. If "No" is selected, the application closes immediately.
*   **Menu Bar**
    *   **Game Menu**: Contains "Open game ...", "Save Game ...", "Save Game As...", and "Exit".
    *   **Action Menu**: Contains "Undo" and "Redo". Menu items are unavailable if the associated action is unavailable.
    *   **Statistics Menu**: Contains "Display" and "Erase".
    *   **Help Menu**: Contains "About". Selecting this displays a window with the text "Qheadache 1.0 by Jean-Philippe Brossat jp_brossat@yahoo.fr".

## 3.2 Performance requirements

There can be only one user per machine.

## 3.3 Usability requirements

[N/A]

## 3.5 Logical database requirements

*   **Game Save File**: The system shall store game state information in a file. This includes the current positions of all blocks, their last 1000 previous positions, the total number of movements, and the elapsed time.
*   **Statistics File**: The system shall store high scores in a statistics file. This file holds up to 10 entries. Each entry consists of a player's name, the number of block movements, and the time taken to solve the game.

## 3.6 Design constraints

[N/A]

## 3.7 Software system attributes

The software must be portable and run on all operating systems that the Qt graphical library supports, including Windows OS.

## 3.8 Supporting information

[N/A]

# 4 Verification

## 4.1 Functions

[N/A]

## 4.2 Performance requirements

[N/A]

## 4.3 Usability requirements

[N/A]

## 4.5 Logical database requirements

[N/A]

## 4.6 Design constraints

[N/A]

## 4.7 Software system attributes

[N/A]

# 5 Appendices

## 5.1 Assumptions and dependencies

[N/A]

## 5.2 Acronyms and abbreviations

[N/A]