feat: fully functional CLI and Avalonia UI for Snake game
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user