示例#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();
 }