public void Start() { //int k = 0; Thread thread = new Thread(snake.ChangeDirection); thread.Start(); while (IsAlive) { snake.Move(); Draw(); Thread.Sleep(speed); if (snake.isCollisionWithFood(food)) { snake.body.Add(new Point(0, 0)); food.Generate(snake, wall); if (snake.body.Count % 5 == 0) { wall.NextLevel(); speed = Math.Max(0, speed - 200); } } if (snake.isCollisionWithWall(wall)) { IsAlive = false; Console.SetCursorPosition(10, 10); Console.Write("Game over"); } } }