feat: initial project structure with Snake.Core, CLI and Avalonia skeleton

This commit is contained in:
Heller
2026-06-17 19:02:07 +00:00
commit 42fcaf8631
25 changed files with 661 additions and 0 deletions

24
Snake.Core/Board.cs Normal file
View File

@@ -0,0 +1,24 @@
namespace Snake.Core;
public sealed class Board
{
public Board(int width, int height)
{
if (width < 2)
throw new ArgumentOutOfRangeException(nameof(width), "Width must be at least 2.");
if (height < 2)
throw new ArgumentOutOfRangeException(nameof(height), "Height must be at least 2.");
Width = width;
Height = height;
}
public int Width { get; }
public int Height { get; }
public bool IsWithinBounds(Position position) =>
position.X >= 0 && position.X < Width &&
position.Y >= 0 && position.Y < Height;
}