# 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 Definitions, Acronyms, and Abbreviations
Not applicable.

## 1.4 References
Not applicable.

## 1.5 SRS Document Overview
The remaining sections of this document provide a general description, including characteristics of the users of this project, the product's hardware, and the functional and data requirements of the product. 
General description of the project is discussed in section 2 of this document. 
Section 2 gives the functional requirements, data requirements and constraints and assumptions made while designing the game. 
It also gives the user viewpoint of product use. 
Section 3 gives the specific requirements of the product. 
Section 3.0 also discusses the external interface requirements and gives detailed description of functional requirements.

# 2 GENERAL DESCRIPTION
## 2.1 Product Perspective
### 2.1.1 User Interfaces 
The product runs as a stand­alone application.
Its user interface uses menus, graphics and sounds.

### 2.1.2 Hardware Interfaces 
The product requires the use of a keyboard and a mouse to interface with the user. 
It requires a graphical display of at least 800*600 resolution.

### 2.1.3 Software Interfaces
The product uses the Qt graphical library. 
It must run with all the operating systems that Qt supports.

### 2.1.4 Communications Interfaces
Not applicable.

### 2.1.5 Memory Constraints
Not applicable.

### 2.1.6 Site Adaptation Requirements
Not applicable.

## 2.2 Product Functions
### 2.2.1 Undo et Redo Actions.
The user must undo and redo its last thousand actions.

### 2.2.2 Time passed to play.
The product must count and display the time that the user uses to play.

### 2.2.3 Count of action number.
The product must count and display the number of the user's action.

### 2.2.4 Score.
The product must record the score (time and number of counts) of a play associated with the name of a user.

### 2.2.5 Score windows.
The product must display a window with all the player's scores.

## 2.3 User Characteristics
No qualification is necessary.

## 2.4 Start Up Requirements
Not applicable.

## 2.5 Apportioning of Requirements
Not applicable.

# 3 SPECIFIC REQUIREMENTS
## 3.1 External Interfaces
The product generally requires a mouse and a keyboard for input. 
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 uses menus, graphics and sounds. 
The hardware and operatingsystem must provide an 800x600 screen resolution. 
Sound is not required to play the game.

### 3.1.1 User Interfaces
#### 3.1.1.1 Introduction
The users consist of anyone who wants to play a simple game who knows how to operate a computer, with a beginning level player starting at age 8, up through an advanced level player who could be an adult. 

#### 3.1.1.2 Main window
The main window shall provide the following parts: 
– A board, see chapter 3.2.1.1.
– a menu bar, see chapter 3.2.5.

### 3.1.2 Software Interfaces
Not applicable.

### 3.1.3 Communications Interfaces
Not applicable.

## 3.2 Functional Requirements
### 3.2.1 Actions.
#### 3.2.1.1 Presentation of the board.
The board is a rectangular zone where the user could move some blocks. 
Let x be the mesure unit. 
The height of the board game is 5x, its width is 4x : x can't be less than 50 pixels and greater than 100 pixels.
The blocks are separated by a marge of 0.1x.
There are four square blocks with a side of x.
There are four rectangular blocks with the following dimensions : a height of 2x and a width of x.
There is one block with the following dimensions : 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.

#### 3.2.1.2 Block selection
3.2.1.2.1 Description
See above chapter 3.2.1.1.

3.2.1.2.2 Input
Left-­clicked down on a block.

3.2.1.2.3 Processing
The game state becomes "Block deplacement".

3.2.1.2.4 Output
None.

#### 3.2.1.3 Block deselection
3.2.1.3.1 Description
See above chapter 3.2.1.1.

3.2.1.3.2 Input
Left­-clicked up on a selected block.

3.2.1.3.3 Processing
The game state becomes "Block selection".

3.2.1.3.4 Output
None.

#### 3.2.1.4 Block movement
3.2.1.4.1 Description
See above chapter 3.2.1.1.

3.2.1.4.2 Input
Mouse movement during the "Block movement" state. 

3.2.1.4.3 Processing
The selected block follows the mouse movement without overlap the other blocks and exit of the game zone. 
The selected block can't move near other blocks at least 0.05x from the others blocks.

3.2.1.4.4 Output
None.

#### 3.2.1.5 Undo Action

3.2.1.5.1 Descritption
The user can cancel a movement.

3.2.1.5.2 Input
Menu selection.

3.2.1.5.3 Processing
The game displays the block positions at the places where they were before the last movement. 
This action is consider like a movement. 
The "undo" action is unvailable if there was no previous movement.

3.2.1.5.4 Output
New game board display.

#### 3.2.1.6 Redo Action
3.2.1.6.1 Descritption
The user can redo a movement that has been canceled.

3.2.1.6.2 Input
Menu selection.

3.2.1.6.3 Processing
The game displays the block positions at the places where they were before the last movement was canceled. 
This action is consider like a movement. 
The redo action is unvailable, if the previous action wasn't an "undo" action.

3.2.1.6.4 Output
New game board display.

### 3.2.2 End of the game management
#### 3.2.2.1 End of the game 
3.2.2.1.1 Description
How the user finishs the game.

3.2.2.1.2 Input
The great square is moved at the bottom of the board.

3.2.2.1.3 Processing
All the player statistics are freezed.

3.2.2.1.4 Outputs
If the number of block movements of the current player is lower than the highest number of block movement recorded in the statistic file, the The "Finish Window with Statistcs" is displayed, see chapter 3.2.2.2. 
If not the "Simple finish Window" is displayed, see chapter 3.2.2.3.

#### 3.2.2.2 Finish Window with Statistics.
3.2.2.2.1 Description
The Finish Window with Statisctis contains a the following text : "You win ! Enter your name : ", an Edit Box that can contain 20 characters and a pushbutton with the label "OK".

3.2.2.2.2 Input
The games is over, see chapter 3.2.2.1.

3.2.2.2.3 Processing
The player clicks on the pushbutton "OK". 
The player statistics are recorded in the statistic file of the software, according to the requirement of the chapter 3.2.3.2.

3.2.2.2.4 Outputs
The "finish" window is closed. 
The statistic window is displayed, see chapter 3.2.3.4.

#### 3.2.2.3 Simple Finish Window
3.2.2.3.1 Description
The Simple Finish Window contains a the following text : "You win !" and a pushbutton with the label "OK".

3.2.2.3.2 Input
The games is over, see chapter 3.2.2.1.

3.2.2.3.3 Processing
The player clicks on the pushbutton "OK".

3.2.2.3.4 Outputs
The Simple Finish Window is closed. 
The statistic window is displayed, see chapter 3.2.3.4.

### 3.2.3 Statistics Management.
#### 3.2.3.1 Player Statistics management
3.2.3.1.1 Desciption
The following statistics are recorded during the game:
– number of block movements since the start,
– time since the start.

3.2.3.1.2 Input
A block movement.

3.2.3.1.3 Processing
The number of block movement in incremented of 1. 
The difference of time of the block movement and the previous recorded time is recorded.

3.2.3.1.4 Output
None.

#### 3.2.3.2 Game Statistics management
3.2.3.2.1 Desciption
The game statistics is composed of 10 player statistics.

3.2.3.2.2 Input
The Finish Window with Statistics is completed by the player, see chapter 3.2.2.2.

3.2.3.2.3 Processing
The statistics of the player (its name, the block movement number, the time passed to solve the headache) is recorded in the statistic file.
If 10 player statistics are already recorded, the player statistics of the file with the greatest number of block movements is erased.

3.2.3.2.4 Output
If the file was correctly updated, there is no ouput. 
If not, like wrong pemissions or disk full, an error message is displayed.

#### 3.2.3.3 Statistics erasing
3.2.3.3.1 Descritption
The user could erase all the statistics.

3.2.3.3.2 Input
Menu selection.

3.2.3.3.3 Processing
The data stored in the statistic file are erased.

3.2.3.3.4 Output
If the file was correctly updated, there is no ouput. 
If not, like wrong pemissions or disk full, an error message is displayed.

#### 3.2.3.4 Statistic Window.
3.2.3.4.1 Descritption
The Player Statistics Window is composed of a listbox of 10 lines.
Each line is composed of the name of a player, the number of block movement, the time used by the player to solve the headache. 
This statistcs are read from the statistic file of the game.

3.2.3.4.2 Input
End of the game (see chapter 3.2.2.1) or menu selection.

3.2.3.4.3 Processing
Window display.

3.2.3.4.4 Output
None.

### 3.2.4 File management
#### 3.2.4.1 Open game
3.2.4.1.1 Description
Open a previous saved game.

3.2.4.1.2 Input
Menu selection.

3.2.4.1.3 Processing
A dialog box is open : the user could choose a file that contains all the data of the game previously saved.

3.2.4.1.4 Output
The board game is re­draw according to the file data. 
The player statistics are set to the player statistics of the file data.

#### 3.2.4.2 Save game
3.2.4.2.1 Description
Save the current game.

3.2.4.2.2 Input
Menu selection.

3.2.4.2.3 Processing
If the game was never saved, the processing is identiqual to the action "Save as...".
If not, the following internal data are saved into the previous file that was used to to save the the game : the current positions of the blocks, their last 10000 previous positions, the number of the previous movements and the time passed by the user to solve the headache.

3.2.4.2.4 Output
None.

#### 3.2.4.3 Save game as
3.2.4.3.1 Description
Save the current game.

3.2.4.3.2 Input
Menu selection.

3.2.4.3.3 Processing
A dialog box is open : the user could choose a file that will contain all the data of the current game. 
Next, the following internal data are saved into the file : the current positions of the blocks, their previous positions, the number of the previous movements and the time passed by the user to solve the headache.

3.2.4.3.4 Output
None.

#### 3.2.4.4 Exit
3.2.4.4.1 Description
Stop the game.

3.2.4.4.2 Input
Menu selection.

3.2.4.4.3 Processing
If the game is not saved, a dialog box is displayed that asks to the player if he wants to save the game. 
Two choices are possible : "Yes" and "No". 
If "Yes" is selected, the action "Save" is processed and the main window disappeared. 
If "No" is selected, the main window disappeared.

3.2.4.4.4 Output
None.

### 3.2.5 Menu bar
#### 3.2.5.1 Game menu
3.2.5.1.1 Description
Contains "Open game ...", "Save Game ...", "Save Game As..." and "Exit". 
In this order. 

3.2.5.1.2 Input
Menu selection. 

3.2.5.1.3 Processing
Action in question is performed :
– "Open game ..." ­> action "Open game", see chapter 3.2.4.1,
– "Save Game ..." ­> action "Save Game", see chapter 3.2.4.2,
– "Save Game As ..." ­> action "Save game as", see chapter 3.2.4.3,
– "Exit" ­> action "Exit", see chapter 3.2.4.4.

3.2.5.1.4 Output
Menu disappears. 
Requirements of the action determines the continuation. 

#### 3.2.5.2 Action menu
3.2.5.2.1 Description
Contains "Undo" and "Redo".
In this order. 
The menu selection is unvailable if the associated action is unvailable.

3.2.5.2.2 Inputs
Menu selection. 

3.2.5.2.3 Processing
Action in question is performed :
– "Undo" ­> action "Undo", see chapter 3.2.1.5,
– "Redo" ­> action "Redo", see chapter 3.2.1.6.

3.2.5.2.4 Outputs
Menu disappears. 
Requirements of the action determines the continuation. 

#### 3.2.5.3 Statisctis menu
3.2.5.3.1 Description
Contains "Display" and "Erase". 
In this order. 

3.2.5.3.2 Inputs
Menu selection. 

3.2.5.3.3 Processing
Action in question is performed :
– "Display" ­> displays the statistic window, see chapter 3.2.3.4,
– "Erase" ­> erase the statistics, see chapter 3.2.3.3.

3.2.5.3.4 Outputs
Menu disappears. 
Requirements of the action determines the continuation. 

#### 3.2.5.4 Help menu
3.2.5.4.1 Description
Contains "About". 

3.2.5.4.2 Inputs
Menu selection. 

3.2.5.4.3 Processing
"About Window" is displayed. 
The "About Windows" is composed of the following text "Qheadache 1.0 by Jean­Philippe Brossat jp_brossat@yahoo.fr"

3.2.5.4.4 Outputs
Menu disappears. 
Requirements of the action determines the continuation.

## 3.3 Performance Requirements
There can be only one user per machine.

## 3.4 Software System Attributes
The software must be portable to the Windows OS.