public void SnakeLong(string position, ref string myBreak)
        {                     //蛇移动
            Gm.Point NewHaed; //= SnakePoint[0];
            //SnakePoint.Add(res);
            switch (position)
            {//根据玩家按键不同,将蛇头向不同方向移动一格(所以按的越快动的越快...)
            //注意,还设置了禁止按下的键(例如此时按下`UpArrow`也就是上,则返回一个`DownArrow`也就是下,告知外界此按键下次无效)
            case "UpArrow":
                NewHaed = SnakePoint[0];
                NewHaed.Y--;
                SnakePoint.Insert(0, NewHaed);
                myBreak = "DownArrow";
                break;

            case "DownArrow":
                NewHaed = SnakePoint[0];
                NewHaed.Y++;
                SnakePoint.Insert(0, NewHaed);
                myBreak = "UpArrow";
                break;

            case "LeftArrow":
                NewHaed = SnakePoint[0];
                NewHaed.X--;
                SnakePoint.Insert(0, NewHaed);
                myBreak = "RightArrow";
                break;

            case "RightArrow":
                NewHaed = SnakePoint[0];
                NewHaed.X++;
                SnakePoint.Insert(0, NewHaed);
                myBreak = "LeftArrow";
                break;

            default:
                break;
            }
            SnakeHaed = SnakePoint[0];//移动过后的新舌头
            //死亡判断
            if (SnakeHaed.X <= 0 || SnakeHaed.X >= Gm.width - 1 || SnakeHaed.Y <= 0 || SnakeHaed.Y >= Gm.height - 1)
            {//撞墙死亡
                Gm.GameOver = true;
            }
            for (int i = 3; i < snakePoint.Count; i++)
            {//吃自己死亡(无论如何吃不到自己的前三节)
                if (SnakeHaed.X == SnakePoint[i].X && SnakeHaed.Y == SnakePoint[i].Y)
                {
                    Gm.GameOver = true;
                }
            }
            SnakeBack = SnakePoint[SnakePoint.Count - 1];
            if (!Food.eatBool)
            {//没吃到,删除尾巴(迟到了就不删除)
                //注意,这里是数据层,绘制还有看Map的表现层.
                SnakePoint.Remove(SnakePoint[SnakePoint.Count - 1]);
            }
        }
 public static bool eatBool = false; //是否吃到食物
 public void EatFood(Gm.Point snakeHaed)
 {                                   //尝试由蛇来吃食物
     if (eatBool)
     {
         eatBool = false;
     }
     if (snakeHaed.X == FoodPoint.X && snakeHaed.Y == FoodPoint.Y)
     {                   //蛇头和食物是否重叠
         eatBool = true; //被吃了
         // RemoveFood();
         RandomFood();   //随机一个新的食物
         SpawnFood();    //显示新的食物
     }
 }
 public void Redraw(Gm.Point snake, Gm.Point point)  //一次绘图(每帧都会运行)
 {
     if (Gm.GameOver)
     {//游戏结束
         GG();
     }
     Console.SetCursorPosition(snake.X, snake.Y);     //移动光标到蛇头
     Console.Write('@');                              //绘制蛇头
     if (!Food.eatBool)                               //没吃到就擦除蛇尾
     {
         Console.SetCursorPosition(point.X, point.Y); //同样,光标到蛇尾
         Console.Write(' ');                          //设置为空白
     }
     Console.SetCursorPosition(Gm.width, Gm.height);
 }