Пример #1
0
        //TODO code to iterate over the boxList and place the snake in the center of the screen.
        public void PlaceSnake(Player snake)
        {
            CalculateSpace();

            if (height % 2 == 0 && width % 2 == 0)
            {
                snake.SetCoord(middleOfBoxEven);
                boxList.RemoveAt(middleOfBoxEven);
                boxList.Insert(middleOfBoxEven, "s");
            }
            else if (width % 2 != 0 && height % 2 == 0)
            {
                snake.SetCoord(middleOfBoxEven);
                boxList.RemoveAt(middleOfBoxEven);
                boxList.Insert(middleOfBoxEven, "s");
            }
            else
            {
                snake.SetCoord(middleOfBoxOdd);
                boxList.RemoveAt(middleOfBoxOdd);
                boxList.Insert(middleOfBoxOdd, "s");
            }
        }