public static void SetUpBoard()
 {
     for (int square = 0; square < TOTAL_NUMBER_OF_SQUARES; square++)
     {
         if (square == START_SQUARE_NUMBER)
         {
             gameBoard[square] = new Square("Start", square);
         }
         else if (square % LOSE_SQUARE_FACTOR == 0)
         {
             gameBoard[square] = new Lose_Square(square.ToString(), square);
         }
         else if (square % CHANCE_SQUARE_FACTOR == 0)
         {
             gameBoard[square] = new Chance_Square(square.ToString(), square);
         }
         else if (square % WIN_SQUARE_FACTOR == 0 && square % LOSE_SQUARE_FACTOR != 0 && square != FINISH_SQUARE_NUMBER)
         {
             gameBoard[square] = new Win_Square(square.ToString(), square);
         }
         else if (square == FINISH_SQUARE_NUMBER)
         {
             gameBoard[square] = new Square("Finish", square);
         }
         else
         {
             gameBoard[square] = new Square(square.ToString(), square);
         }
     }
 }
示例#2
0
        public static void SetUpBoard()
        {
            for (int i = (START_SQUARE + 1); i < TOTAL_SQUARES; i++)
            {
                if ((i % 10) == 0)
                {
                    gameBoard[i] = new Lose_Square(i.ToString(), i);
                }
                else if ((i % 5 == 0) && ((i % 10) != 0))
                {
                    gameBoard[i] = new Win_Square(i.ToString(), i);
                }
                else if (i % 6 == 0)
                {
                    gameBoard[i] = new Chance_Square(i.ToString(), i);
                }
                else
                {
                    gameBoard[i] = new Square(i.ToString(), i);
                }
            }

            gameBoard[START_SQUARE] = new Square("Start", START_SQUARE);
            gameBoard[END_SQUARE]   = new Square("Finish", END_SQUARE);
        }