An interactive console game implementation focusing on method creation and parameter handling in C#. This project extends the Microsoft Learn starter code with additional functionality and game mechanics.
The program is currently under active development, with ongoing bug fixes. Contributions and suggestions are welcome in the repository's Issues section, and all viable solutions will be reviewed.
public class Game
{
void InitializeGame(); // Sets up initial game state
bool TerminalResized(); // Checks console window dimensions
void ShowFood(); // Displays food elements
void ChangePlayer(); // Updates player appearance
void FreezePlayer(); // Implements player freeze mechanic
void Move(); // Handles player movement
}
The Move()
method accepts two optional parameters:
check
: Controls game terminationspeed
: Modifies movement speed
- Implement terminal resize detection
- Add non-directional key game termination
void AnnounceTerminating()
{
// Handles game termination conditions
// Uses Random class for termination parameter
}
- Terminal resize detection
- Random-based game termination
- Non-directional key handling
- Food system implementation
- Player appearance updates
bool JustAteFood()
{
// Manages food consumption
// Triggers player appearance changes
}
- Dynamic food updates
- Player appearance management
- State tracking system
- Implement temporary player freezing
- Add speed boost mechanics
public class PlayerMechanics
{
bool CheckMovementSpeed() // Handles speed boost for (^-^)
bool CheckFreezeCondition() // Manages freeze state for (X_X)
}
Appearance | Effect | Implementation |
---|---|---|
(X_X) |
Temporary freeze | CheckFreezeCondition() |
(^-^) |
Speed boost (×3) | CheckMovementSpeed() |
- Dynamic player states
- Speed modification system
- Temporary freeze mechanics
- Food collection system
- Terminal size adaptation
- Practice consistently
- Experiment with the code
- Join the discussion for bug fixes
- Test different game scenarios
graph TD
A[Start Game] --> B{Terminal Sized OK?}
B -->|Yes| C[Initialize Game]
B -->|No| D[Terminate]
C --> E{Player State}
E -->|Normal| F[Move]
E -->|Frozen| G[Wait]
E -->|Speed Boost| H[Fast Move]
This project is licensed under the MIT Licence. See the LICENCE file for further details.