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

@@ -24,6 +24,13 @@ public sealed class SnakeGame
public bool IsGameOver { get; private set; }
public const int PointsPerLevel = 5;
public int Level => 1 + Score / PointsPerLevel;
public static int GetTickIntervalMs(int score, int baseIntervalMs = 120, int minIntervalMs = 50) =>
Math.Max(minIntervalMs, baseIntervalMs - (1 + score / PointsPerLevel - 1) * 10);
public void SetDirection(Direction direction) => Snake.SetDirection(direction);
public GameTickResult Tick()