Esempio n. 1
0
 public void Move()
 {
     head = NextPoint();
     snake.Add(head);
     tail = snake.First();
     snake.Remove(tail);
     tail.Clear();
     head.Put();
 }
Esempio n. 2
0
 public bool Eat(Point p)
 {
     head = NextPoint();
     if (head == p)
     {
         snake.Add(head);
         head.Put();
         return(true);
     }
     return(false);
 }
Esempio n. 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();
     }
 }
Esempio n. 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);
            }
        }
Esempio n. 5
0
 public void Create()
 {
     food = (random.Next(2, x - 1), random.Next(2, y - 1), ch);
     food.Put();
 }