Exemple #1
0
        public bool NextStep()
        {
            Point nextPoint = snake.MoveNext();
            Char  boardChar = board.GetValue(nextPoint.Xlocation, nextPoint.Ylocation);

            if (boardChar == 'o' || boardChar == '*')
            {
                GameOver();
                return(false);
            }
            else
            {
                board.UpdateBoard(nextPoint);
                if (boardChar == ' ')
                {
                    Point space = new Point(snake.SnakeArray[snake.SnakeArray.Count - 1].Xlocation, snake.SnakeArray[snake.SnakeArray.Count - 1].Ylocation, ' ');
                    board.UpdateBoard(space);
                    snake.SnakeMove();
                }
                if (boardChar == '+')
                {
                    scroe++;
                }
                return(true);
            }
        }