static void game(object all1) { int a = 0, b = 40, c = 18, da = 1, lll = 3; int g = snake.Random1(a, b); int g1 = snake.Random2(a, c); while (true ) { if (direction == 3) { snake.Move(0, -1); } if (direction == 1) { snake.Move(-1, 0); } if (direction == 2) { snake.Move(1, 0); } if (direction == 4) { snake.Move(0, 1); } if (snake.CollisionWithWall(wall) || snake.Collision()) { Console.Clear(); Console.SetCursorPosition(5, 5); Console.WriteLine("GAME OVER!!!!"); Console.ReadKey(); snake = new Snake(); level = 1; wall = new Wall(level); } Console.Clear(); if (da % lll == 0) { lll *= 2; level++; wall = new Wall(level); } if (snake.CollisionWithFood(g, g1)) { da++; g = snake.Random1(a, b); g1 = snake.Random2(a, c); } if (wall.FoodInWall(g, g1) == true && snake.FoodInMe(g, g1) == true ) { snake.DrawFood(g, g1); } else { g = snake.Random1(a, b); g1 = snake.Random2(a, c); snake.DrawFood(g, g1); } snake.Draw(direction); wall.Draw(); Thread.Sleep(100); } }