Пример #1
0
 public void Move()
 {
     head = NextPoint();
     snake.Add(head);
     tail = snake.First();
     snake.Remove(tail);
     tail.Clear();
     head.Put();
 }
Пример #2
0
 public bool Eat(Point p)
 {
     head = NextPoint();
     if (head == p)
     {
         snake.Add(head);
         head.Put();
         return(true);
     }
     return(false);
 }
Пример #3
0
 public Snake(int x, int y, int length)
 {
     direction = "right";
     snake     = new List <Point>();
     for (int i = x - length; i < x; i++)
     {
         Point p = (i, y, '*');
         snake.Add(p);
         p.Put();
     }
 }
Пример #4
0
        public Walls(int x, int y, char ch)
        {
            for (int i = 0; i <= x; i++)
            {
                Point p = (i, 0, ch);
                p.Put();
                wall.Add(p);
                p.y = y;
                p.Put();
                wall.Add(p);
            }

            for (int i = 0; i <= y; i++)
            {
                Point p = (0, i, ch);
                p.Put();
                wall.Add(p);
                p.x = x;
                p.Put();
                wall.Add(p);
            }
        }
Пример #5
0
 public void Create()
 {
     food = (random.Next(2, x - 1), random.Next(2, y - 1), ch);
     food.Put();
 }