public MainWindow() { InitializeComponent(); BoardWidth = 100; BoardHeight = 100; Paused = true; var generator = new BoardGenerator(); _cells = generator.GenerateCells(BoardWidth, BoardHeight); Grid = generator.GenerateGrid(BoardWidth, BoardHeight); foreach (var cell in _cells) { Grid.Children.Add(cell.Label); } _snake = new Snake(); _snake.Position = new Vector2(BoardWidth / 2, BoardHeight / 2); MakeFood(); var initialTail = new Vector2(_snake.Position.X - 2, _snake.Position.Y); var initialMidriff = new Vector2(_snake.Position.X - 1, _snake.Position.Y); var initialHead = new Vector2(_snake.Position.X, _snake.Position.Y); MakeSnake(initialTail); MakeSnake(initialMidriff); MakeSnake(initialHead); _snake.Body.Enqueue(initialTail); _snake.Body.Enqueue(initialMidriff); _snake.Body.Enqueue(initialHead); _snake.Speed = Speed.Comfortable; _snake.TargetPosition = _target.Position; _snake.Length = 3; GameBoard.Content = Grid; }