feat: fully functional CLI and Avalonia UI for Snake game

This commit is contained in:
Heller
2026-06-17 19:03:22 +00:00
parent 42fcaf8631
commit 0d9710965c
6 changed files with 207 additions and 13 deletions

View File

@@ -7,7 +7,7 @@ internal static class ConsoleRenderer
public static void Render(SnakeGame game)
{
Console.Clear();
Console.WriteLine($"Score: {game.Score}");
Console.WriteLine($"Score: {game.Score} Level: {game.Level}");
if (game.IsGameOver)
Console.WriteLine("Game Over! Press R to restart or Q to quit.");

View File

@@ -3,7 +3,7 @@ using Snake.Core;
const int boardWidth = 20;
const int boardHeight = 15;
const int tickMs = 120;
const int baseTickMs = 120;
SnakeGame game = new(boardWidth, boardHeight);
ConsoleRenderer.Render(game);
@@ -40,5 +40,5 @@ while (true)
game.Tick();
ConsoleRenderer.Render(game);
Thread.Sleep(tickMs);
Thread.Sleep(SnakeGame.GetTickIntervalMs(game.Score, baseTickMs));
}