static void Main() { Console.CursorVisible = false; Console.BufferWidth = Console.WindowWidth = 50; Console.BufferHeight = Console.WindowHeight = 30; Coords direction = new Coords(0, -1); Apple apple = new Apple(); Rocks rock = new Rocks(); Snake snake = new Snake(); WelcomeMessage(); DrawBoarder(); // Game Loop while (!isGameOver) { ResetWindowSize(); Console.ForegroundColor = ConsoleColor.Black; // just so you cant write in the console Input(direction); rock.Update(snake, apple); apple.Update(snake, rock); snake.Update(direction, apple, rock); apple.Draw(); rock.Draw(); snake.Draw(direction); speed = ChangeSpeed(score, speed); Thread.Sleep(speed); snake.Delete(); apple.Delete(); } Console.Clear(); Console.SetCursorPosition(20, 6); Console.WriteLine("GAME OVER!"); Console.SetCursorPosition(18, 8); Console.WriteLine("Your Score: " + score); // for replay Console.SetCursorPosition(17, 10); Console.WriteLine("Replay ? (Y / N)"); ConsoleKeyInfo key = Console.ReadKey(); if (key.Key == ConsoleKey.Y) { direction = new Coords(0, -1); apple = new Apple(); snake = new Snake(); isGameOver = false; score = 0; speed = 100; GC.Collect(); Console.Clear(); Main(); } else { return; } }