Пример #1
0
        public void RandomizeRoom(char p)
        {
            Room temp;

            Room[] myAdjacentRooms;
            Random r = MyMap.r;
            int    count;

            do
            {
                count           = 0;
                temp            = new Room(MyMap.getRandomRoom());
                myAdjacentRooms = MyCave.getConnectedRooms(temp.getDecimalForm());

                if (MyMap.randomizeCharacterRoom(temp.getIntegerForm(), myAdjacentRooms, p))
                {
                    count++;
                }
            } while (MyMap.isRoomNotOkay(temp, p));

            if (p == 'p')
            {
                MyMap.setPlayerRoom(temp);
            }
            else if (p == 'w')
            {
                MyMap.setWumpusRoom(temp.getIntegerForm());
            }
        }
Пример #2
0
        private void RandomizeRoom(char p)
        {
            Room temp;

            Room[] myAdjacentRooms;
            Random r = MyMap.r;
            int    count;

            do
            {
                count           = 0;
                temp            = new Room(MyMap.getRandomRoom());
                myAdjacentRooms = MyCave.loadCaveandRoom(temp.getDecimalForm());

                if (MyMap.randomizeCharacterRoom(temp.getIntegerForm(), myAdjacentRooms, p))
                {
                    count++;
                }
            } while (MyMap.isRoomOkay(temp, p));

            MyMap.setPlayerRoom(temp);
            MyMap.addToExplored(temp);
        }