## 1.1 Purpose
This specification establishes the requirements for the product named Qheadache. The intended audience includes the analyst, programmer, and tester of Qheadache.

## 1.2 Scope

The software product to be produced is named Qheadache. It is a computerized game designed to provide an interface for solving a specific puzzle or challenge, referred to as a "headache." The application of Qheadache is to offer an engaging and interactive gaming experience that challenges users to solve the puzzle efficiently. The primary objective of the software is to entertain users while providing a platform to improve problem-solving skills. The game is intended to be accessible to a wide range of users, from beginners as young as eight years old to advanced players, including adults.

### 1.3.1 Product perspective

The Qheadache game is a stand-alone application that operates independently and does not form part of a larger system. It is designed to run on personal computers and interfaces with users through a graphical user interface (GUI) that includes menus, graphics, and sounds.

#### System interfaces
[N/A]

#### User interfaces
The user interface of Qheadache is designed to be intuitive and accessible, utilizing menus, graphics, and sounds to enhance user interaction. The main window includes a board for gameplay and a menu bar for navigation. The interface is suitable for users starting from age 8 and requires basic computer operation skills.

#### Hardware interfaces
Qheadache requires a keyboard and a mouse for user input. It also necessitates a graphical display with a minimum resolution of 800x600 pixels. The game can accommodate other pointing devices that provide similar functionality to a mouse and keyboard.

#### Software interfaces
The game utilizes the Qt graphical library, which allows it to run on all operating systems supported by Qt. This ensures compatibility across multiple platforms, including Windows OS.

#### Communications interfaces
[N/A]

#### Memory constraints
[N/A]

#### Operations
The game operates in a user-initiated mode, where users can start, save, and exit the game at their discretion. It includes features for undoing and redoing actions, as well as managing game statistics and saving game progress.

#### Site adaptation requirements
[N/A]

#### Interfaces with services
[N/A]

### 1.3.2 Product functions

The Qheadache game software provides several key functions to enhance user interaction and gameplay experience:

- **Undo and Redo Actions**: Users can undo and redo their last thousand actions, allowing for flexible gameplay adjustments.
- **Time Tracking**: The software tracks and displays the time spent by the user during gameplay.
- **Action Count**: It counts and displays the number of actions performed by the user.
- **Score Recording**: The game records the user's score, which includes time and action count, and associates it with the user's name.
- **Score Display**: A window is available to display all the player's scores, providing a comprehensive view of performance.
- **Game Board Interaction**: Users can interact with a game board to move blocks, with specific rules for block selection, deselection, and movement.
- **Game End Management**: The game provides different windows upon completion, depending on the player's performance, and records statistics if applicable.
- **Statistics Management**: The software manages player and game statistics, allowing for recording, displaying, and erasing of statistics.
- **File Management**: Users can open, save, and save games as new files, ensuring game progress is maintained.
- **Menu Navigation**: The game includes a menu bar with options for game management, actions, statistics, and help, facilitating easy navigation and control.

These functions are designed to provide a comprehensive and engaging user experience, allowing players to track their progress and manage their gameplay effectively.

### 1.3.3 User characteristics

The intended users of the product are individuals who wish to play a simple computerized game. No specific qualifications are necessary, and the game is accessible to a wide range of users, from beginners starting at age 8 to advanced players, including adults. Users are expected to have basic computer operation skills, such as using a mouse and keyboard. There are no specific educational or technical expertise requirements, making the game suitable for a general audience.

### 1.3.4 Limitations

- **Hardware Limitations**: The product requires a graphical display with a minimum resolution of 800x600 and the use of a keyboard and mouse for interaction.
- **Interfaces to Other Applications**: The product uses the Qt graphical library and must be compatible with all operating systems supported by Qt.
- **Quality Requirements**: The software must be portable to the Windows OS.
- **User Limitations**: There can be only one user per machine.
- **Safety and Security Considerations**: [N/A]
- **Regulatory Requirements and Policies**: [N/A]
- **Parallel Operation**: [N/A]
- **Audit Functions**: [N/A]
- **Control Functions**: [N/A]
- **Higher-Order Language Requirements**: [N/A]
- **Signal Handshake Protocols**: [N/A]
- **Criticality of the Application**: [N/A]
- **Physical/Mental Considerations**: No specific qualifications are necessary for users.
- **Limitations from Other Systems**: [N/A]

## 1.4 Definitions
[N/A]

# 2 References
[N/A]

## 3.1 Functions

The Qheadache game software is designed to perform several fundamental actions to accept and process inputs, and to generate outputs. The following subsections describe these functions in detail:

### 3.1.1 Undo and Redo Actions
- **Input**: Menu selection.
- **Processing**: 
  - Undo: Reverts the game to the state before the last movement. This action is considered a movement itself and is unavailable if there was no previous movement.
  - Redo: Reapplies a movement that was undone. This action is considered a movement and is unavailable if the previous action wasn't an "undo" action.
- **Output**: Updates the game board display to reflect the new state.

### 3.1.2 Time Tracking
- **Function**: The software tracks and displays the time elapsed during gameplay.

### 3.1.3 Action Count
- **Function**: The software counts and displays the number of actions taken by the user.

### 3.1.4 Score Management
- **Function**: Records the score based on time and action count, associating it with the player's name.
- **Output**: Displays a window with all player scores.

### 3.1.5 End of Game Management
- **Input**: The great square is moved to the bottom of the board.
- **Processing**: Freezes all player statistics.
- **Output**: 
  - If the current player's block movements are fewer than the highest recorded, a "Finish Window with Statistics" is displayed.
  - Otherwise, a "Simple Finish Window" is displayed.

### 3.1.6 Statistics Management
- **Player Statistics**: Records the number of block movements and time since the start.
- **Game Statistics**: Maintains a record of the top 10 player statistics. If the list is full, the player with the greatest number of block movements is removed.
- **Statistics Erasing**: Allows users to erase all statistics via menu selection.

### 3.1.7 File Management
- **Open Game**: Allows users to open a previously saved game.
- **Save Game**: Saves the current game state. If the game was never saved, it prompts the "Save as..." action.
- **Save Game As**: Allows users to save the current game state to a new file.
- **Exit**: Stops the game, prompting the user to save if the game is not already saved.

### 3.1.8 Menu Bar Functions
- **Game Menu**: Includes options for "Open game...", "Save Game...", "Save Game As...", and "Exit".
- **Action Menu**: Includes "Undo" and "Redo" options.
- **Statistics Menu**: Includes "Display" and "Erase" options.
- **Help Menu**: Includes an "About" option displaying information about the software.

### 3.1.9 Error Handling and Recovery
- **Error Messages**: Displayed for issues such as wrong permissions or disk full during file operations.

The software does not specify validity checks on inputs, responses to abnormal situations like overflow, communication facilities, hardware faults, or specific error handling and recovery mechanisms beyond file operation errors. The relationship of outputs to inputs is primarily through the user interface interactions and game state changes.

## 3.2 Performance requirements

There can be only one user per machine. 

[N/A]

## 3.3 Usability requirements

The Qheadache game is designed to be user-friendly and accessible to a wide range of users, including those with minimal computer skills. The following usability requirements are established to ensure an effective, efficient, and satisfying user experience:

- **Effectiveness**: The game should allow users to easily understand and navigate the interface, enabling them to perform actions such as moving blocks, undoing and redoing actions, and managing game statistics without confusion.

- **Efficiency**: Users should be able to complete game tasks, such as solving the puzzle and managing their scores, in a timely manner. The interface should be responsive, with minimal delay in processing user inputs and displaying results.

- **Satisfaction**: The game should provide a satisfying experience by offering clear visual and auditory feedback for user actions. The interface should be visually appealing, with intuitive menus and controls that enhance the overall enjoyment of the game.

- **Avoidance of Harm**: The game should be designed to prevent user frustration or errors by providing clear instructions and feedback. It should also ensure that user data, such as scores and game progress, are accurately recorded and retrievable.

These usability requirements aim to create a positive and engaging experience for all users, from beginners to advanced players. [N/A]

## 3.5 Logical database requirements
[N/A]

## 3.6 Design constraints
[N/A]

## 3.7 Software system attributes

### Portability
The software must be portable to the Windows OS.

## 3.8 Supporting information
[N/A]

## 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.1 Assumptions and dependencies
[N/A]

## 5.2 Acronyms and abbreviations
[N/A]