using System.Collections.ObjectModel; namespace Snake.Model; public class SnakeLevel{ public int Size {get; } public enum LevelBlock{ Empty, Obstacle, Egg, Snake, SnakeHead } public enum SnakeDirection{ Up, Down, Left, Right } private readonly List _obstacles; public ReadOnlyCollection Obstacles => _obstacles.AsReadOnly(); public Point SnakeHead {get; private set;} private readonly List _snake; // Head is not in snake public ReadOnlyCollection Snake => _snake.AsReadOnly(); public int SnakeLength => Snake.Count + 1; private readonly List _eggs; public ReadOnlyCollection Eggs => _eggs.AsReadOnly(); public SnakeDirection SnakeHeadDirection {get; private set;} public SnakeLevel(int size, IEnumerable obstacles, int snake_start_length){ this.Size = size; _obstacles = new List(obstacles); _eggs = []; _snake = []; SnakeHead = (size / 2, snake_start_length-1); for(int i=0; i