This commit is contained in:
foglar 2024-11-13 16:39:36 +01:00
parent 5b905616c1
commit e6ec2633e1
14 changed files with 51 additions and 46 deletions

0
.github/workflows/dotnet.yml vendored Normal file → Executable file
View File

0
.gitignore vendored Normal file → Executable file
View File

0
ARS-pieces.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 642 B

After

Width:  |  Height:  |  Size: 642 B

BIN
GamePrev.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

0
Program.cs Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

0
ShapesData.cs Normal file → Executable file
View File

0
Tetris.csproj Normal file → Executable file
View File

0
Tetris.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 209 KiB

After

Width:  |  Height:  |  Size: 209 KiB

0
Tetris.sln Normal file → Executable file
View File

97
TetrominoFS.md Normal file → Executable file
View File

@ -2,53 +2,54 @@
---
### **1. Document Control**
## **1. Document Control**
| Version | Date | Author | Comments |
|----------|------------|---------------|--------------------------------|
| 1.0 | 16.10.2024 | Filip Kohout | Initial Draft |
| Version | Date | Author | Comments |
| ------- | ---------- | ------------ | ---------------- |
| 1.0 | 16.10.2024 | Filip Kohout | Initial Draft |
| 1.1 | 23.10.2024 | Filip Kohout | UI preview Added |
---
### **2. Table of Contents**
## **2. Table of Contents**
- [**Tetris Game Functional Specification**](#tetris-game-functional-specification)
- [**1. Document Control**](#1-document-control)
- [**2. Table of Contents**](#2-table-of-contents)
- [**3. Introduction**](#3-introduction)
- [**4. Scope**](#4-scope)
- [**5. Definitions and Acronyms**](#5-definitions-and-acronyms)
- [**6. System Overview**](#6-system-overview)
- [**7. Functional Requirements**](#7-functional-requirements)
- [**7.1. Game Loop**](#71-game-loop)
- [**7.2. Tetromino Movement and Rotation**](#72-tetromino-movement-and-rotation)
- [**7.3. Collision Detection**](#73-collision-detection)
- [**7.4. Line Completion**](#74-line-completion)
- [**7.5. Score Calculation**](#75-score-calculation)
- [**7.6. Game Over Condition**](#76-game-over-condition)
- [**7.7. Background Music**](#77-background-music)
- [**7.8. Tetromino Colors**](#78-tetromino-colors)
- [**7.9. Speeding Based on Score**](#79-speeding-based-on-score)
- [**7.10. Terminal Block Size**](#710-terminal-block-size)
- [**7.11. Next Tetromino Preview**](#711-next-tetromino-preview)
- [**8. Non-Functional Requirements**](#8-non-functional-requirements)
- [**9. Assumptions and Dependencies**](#9-assumptions-and-dependencies)
- [**1. Document Control**](#1-document-control)
- [**2. Table of Contents**](#2-table-of-contents)
- [**3. Introduction**](#3-introduction)
- [**4. Scope**](#4-scope)
- [**5. Definitions and Acronyms**](#5-definitions-and-acronyms)
- [**6. System Overview**](#6-system-overview)
- [**7. Functional Requirements**](#7-functional-requirements)
- [**7.1. Game Loop**](#71-game-loop)
- [**7.2. Tetromino Movement and Rotation**](#72-tetromino-movement-and-rotation)
- [**7.3. Collision Detection**](#73-collision-detection)
- [**7.4. Line Completion**](#74-line-completion)
- [**7.5. Score Calculation**](#75-score-calculation)
- [**7.6. Game Over Condition**](#76-game-over-condition)
- [**7.7. Background Music**](#77-background-music)
- [**7.8. Tetromino Colors**](#78-tetromino-colors)
- [**7.9. Speeding Based on Score**](#79-speeding-based-on-score)
- [**7.10. Terminal Block Size**](#710-terminal-block-size)
- [**7.11. Next Tetromino Preview**](#711-next-tetromino-preview)
- [**8. Non-Functional Requirements**](#8-non-functional-requirements)
- [**9. Assumptions and Dependencies**](#9-assumptions-and-dependencies)
---
### **3. Introduction**
## **3. Introduction**
The purpose of this document is to describe the functional requirements for the Tetris game. This document serves as a guideline for developers to implement core features and functionality based on the SRS and provided workflow diagram. The game is developed using C# and runs in a terminal environment.
---
### **4. Scope**
## **4. Scope**
The Tetris game is designed to simulate the classic Tetris gameplay. It involves moving tetromino shapes to fill horizontal lines. The game ends when there is no space to place a new shape. The scope covers basic gameplay, user input handling, scoring, music, block size, and the logic for handling game-ending conditions.
---
### **5. Definitions and Acronyms**
## **5. Definitions and Acronyms**
- **Tetromino**: A geometric shape composed of four squares connected orthogonally.
- **Game Loop**: The core loop responsible for updating and rendering the game state.
@ -57,7 +58,7 @@ The Tetris game is designed to simulate the classic Tetris gameplay. It involves
---
### **6. System Overview**
## **6. System Overview**
The Tetris game will be a single-player application where the user interacts with falling blocks (tetrominoes) to form horizontal lines. The user will be able to move tetrominoes left, right, down, and rotate them. The score will increase as the player completes lines, and the speed of the game will increase based on the score. The game will end when there is no room to place new tetrominoes. The game will also feature background music and tetrominoes will be displayed in different colors.
@ -71,9 +72,9 @@ User will start the game by executing binary, then control block by using arrow
---
### **7. Functional Requirements**
## **7. Functional Requirements**
#### **7.1. Game Loop**
### **7.1. Game Loop**
**Description**:
The game loop is responsible for continuously updating the game state and rendering the current state to the screen. It manages the flow of the game, including the movement of tetrominoes, collision detection, and checking for game-over conditions.
@ -87,10 +88,12 @@ The game loop is responsible for continuously updating the game state and render
- The game loop calls `drawWindow()` to render the current state.
- It handles user inputs via the `handleUserInput()` function.
- Calls `moveBlockDown()` every game tick to advance the falling tetromino.
![Tetris Blocks Image](./ARS-pieces.png)
---
#### **7.2. Tetromino Movement and Rotation**
### **7.2. Tetromino Movement and Rotation**
**Description**:
Users can move tetrominoes left, right, down, or rotate them using keyboard inputs. Movement is constrained by the boundaries of the grid and other placed blocks.
@ -104,10 +107,10 @@ Users can move tetrominoes left, right, down, or rotate them using keyboard inpu
- Left and right arrow keys will trigger `moveBlockLeftRight()` to shift the tetromino.
- The down arrow will trigger faster descent using `moveBlockDown()`.
- The rotate button will rotate the tetromino via the `rotateBlock()` function.
---
#### **7.3. Collision Detection**
### **7.3. Collision Detection**
**Description**:
The system checks for collisions between falling tetrominoes and other blocks or the boundaries of the grid.
@ -122,7 +125,7 @@ The system checks for collisions between falling tetrominoes and other blocks or
---
#### **7.4. Line Completion**
### **7.4. Line Completion**
**Description**:
When a horizontal line is fully filled with blocks, the system will clear the line and shift blocks above it downward.
@ -138,7 +141,7 @@ When a horizontal line is fully filled with blocks, the system will clear the li
---
#### **7.5. Score Calculation**
### **7.5. Score Calculation**
**Description**:
The system calculates the player's score based on the number of lines cleared.
@ -150,10 +153,12 @@ The system calculates the player's score based on the number of lines cleared.
- `updateScore()` will add points for each line cleared.
- Points awarded are based on the number of lines cleared simultaneously.
![Game preview](./GamePrev.png)
---
#### **7.6. Game Over Condition**
### **7.6. Game Over Condition**
**Description**:
The game will end when there is no room to place a new tetromino at the top of the grid.
@ -168,7 +173,7 @@ The game will end when there is no room to place a new tetromino at the top of t
---
#### **7.7. Background Music**
### **7.7. Background Music**
**Description**:
The game will feature background music that plays throughout the game. The music will loop continuously and can be paused or resumed by the player.
@ -184,7 +189,7 @@ The game will feature background music that plays throughout the game. The music
---
#### **7.8. Tetromino Colors**
### **7.8. Tetromino Colors**
**Description**:
Each tetromino will have a distinct color to enhance the visual appeal of the game.
@ -200,7 +205,7 @@ Each tetromino will have a distinct color to enhance the visual appeal of the ga
---
#### **7.9. Speeding Based on Score**
### **7.9. Speeding Based on Score**
**Description**:
The game speed will increase as the players score rises, creating a more challenging experience over time.
@ -216,7 +221,7 @@ The game speed will increase as the players score rises, creating a more chal
---
#### **7.10. Terminal Block Size**
### **7.10. Terminal Block Size**
**Description**:
Due to the proportions of characters in a terminal environment, each tetromino block will be represented by three horizontal characters stacked vertically.
@ -231,7 +236,7 @@ Due to the proportions of characters in a terminal environment, each tetromino b
---
#### **7.11. Next Tetromino Preview**
### **7.11. Next Tetromino Preview**
**Description**:
The player will be able to see a preview of the next tetromino that will spawn after the current one is placed. This allows the player to strategize and plan their moves.
@ -247,7 +252,7 @@ The player will be able to see a preview of the next tetromino that will spawn a
---
### **8. Non-Functional Requirements**
## **8. Non-Functional Requirements**
- **Responsiveness**: The game must run at 60 FPS and handle user input with no visible delay.
@ -256,7 +261,7 @@ The player will be able to see a preview of the next tetromino that will spawn a
---
### **9. Assumptions and Dependencies**
## **9. Assumptions and Dependencies**
- The game assumes a modern system with a keyboard input method.
- It is dependent on a graphical library for rendering and input handling (e.g., `Console` or a library in C# for terminal manipulation).

0
TetrominoSRS.md Normal file → Executable file
View File

0
image.png Normal file → Executable file
View File

0
song.wav Normal file → Executable file
View File