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