Exemplo n.º 1
0
        void build_board()
        {
            Board = new BoardSpace[40];

            // first side
            Board[0]  = new BoardSpace(TileType.GO, 0);
            Board[1]  = new PropertySpace(1, Properties[0].Name, this);
            Board[2]  = new BoardSpace(TileType.COMMUNITY, 2);
            Board[3]  = new PropertySpace(3, Properties[1].Name, this);
            Board[4]  = new BoardSpace(TileType.TAX, 4);
            Board[5]  = new PropertySpace(5, Properties[2].Name, this);
            Board[6]  = new PropertySpace(6, Properties[3].Name, this);
            Board[7]  = new BoardSpace(TileType.CHANCE, 7);
            Board[8]  = new PropertySpace(8, Properties[4].Name, this);
            Board[9]  = new PropertySpace(9, Properties[5].Name, this);
            Board[10] = new BoardSpace(TileType.JAIL, 10);

            //second side
            Board[11] = new PropertySpace(11, Properties[6].Name, this);
            Board[12] = new PropertySpace(12, Properties[7].Name, this);
            Board[13] = new PropertySpace(13, Properties[8].Name, this);
            Board[14] = new PropertySpace(14, Properties[9].Name, this);
            Board[15] = new PropertySpace(15, Properties[10].Name, this);
            Board[16] = new PropertySpace(16, Properties[11].Name, this);
            Board[17] = new BoardSpace(TileType.COMMUNITY, 17);
            Board[18] = new PropertySpace(18, Properties[12].Name, this);
            Board[19] = new PropertySpace(19, Properties[13].Name, this);
            Board[20] = new BoardSpace(TileType.JAIL, 20);

            // third side
            Board[21] = new PropertySpace(21, Properties[14].Name, this);
            Board[22] = new BoardSpace(TileType.COMMUNITY, 22);
            Board[23] = new PropertySpace(23, Properties[15].Name, this);
            Board[24] = new PropertySpace(24, Properties[16].Name, this);
            Board[25] = new PropertySpace(25, Properties[17].Name, this);
            Board[26] = new PropertySpace(26, Properties[18].Name, this);
            Board[27] = new PropertySpace(27, Properties[19].Name, this);
            Board[28] = new PropertySpace(28, Properties[20].Name, this);
            Board[29] = new PropertySpace(29, Properties[21].Name, this);
            Board[30] = new BoardSpace(TileType.GO_TO_JAIL, 30);

            // fourth side
            Board[31] = new PropertySpace(31, Properties[22].Name, this);
            Board[32] = new PropertySpace(32, Properties[23].Name, this);
            Board[33] = new BoardSpace(TileType.COMMUNITY, 33);
            Board[34] = new PropertySpace(34, Properties[2].Name, this);
            Board[35] = new PropertySpace(35, Properties[24].Name, this);
            Board[36] = new BoardSpace(TileType.CHANCE, 36);
            Board[37] = new PropertySpace(37, Properties[25].Name, this);
            Board[38] = new BoardSpace(TileType.TAX, 38);
            Board[39] = new PropertySpace(39, Properties[26].Name, this);
        }
Exemplo n.º 2
0
        public void Move(short spaces, Game game)
        {
            if (spaces > 0)
            {
                // if it is more than 36 (or maximum spaces in one go around)
                if (space.Index == 36)
                {
                    // reset it to 0
                    space.Index = 0;
                }
                else
                {
                    // increase space
                    space = game.Board[space.Index + 1];
                }

                // move again
                Move((short)(spaces - 1), game);
            }
        }