コード例 #1
0
    'Elevator',
    'You attempt to take the elevator but you need an elevator pass', 'e')
openbar = Room('Open Bar',
               'You reached the open bar, there is a man lying on the floor',
               'o')
cafe = Room('Cafe',
            'You are in the Cafe, there is a cash register to your right', 'c')
parkinglot = Room(
    'Parking Lot',
    'You are in the parking lot, there is a car in the distance', 'pl')
entrance = Room(
    'Entrance',
    'You reached the entrance of the hotel, you try to open it but its locked',
    'ent')

frontdesk.add_connection(lobby, "passage", ["south", "s"])
lobby.add_connection(frontdesk, "passage", ["north", "n"])

lobby.add_connection(patio, "hallway", ["west", "w"])
patio.add_connection(lobby, "hallway", ["east", "e"])

lobby.add_connection(elevator, "elevator", ["east", "e"])
elevator.add_connection(lobby, "passage", ["west", "w"])

patio.add_connection(openbar, "passage", ["north", "n"])
patio.add_connection(cafe, "path", ["south", "s"])

openbar.add_connection(patio, "passage", ["south", "w"])
cafe.add_connection(patio, "path", ["north", "n"])

cafe.add_connection(parkinglot, "passage", ["east", "e"])
コード例 #2
0
    'uh')
kitchen = Room(
    'After contemplating life you look around for another way to get deeper into the building and you spot a door that leads into the kitchen',
    'After many attempts at forcefully pushing the door open, you are finally inside the kitchen and there still seems to be no sign of the president',
    'b1')
ceo_office = Room(
    'You continue to venture deeper into the kitchen and you stumble upon the CEO office',
    'The door of the office was wide open so you walked in but as soon as you entered the office you were attacked by a zombie that came out from behind the office door but fortunately the zombie had no legs so you stomped it out',
    'b2')
trapdoor = Room(
    'You start to look at the dark oak table in the center of the office and you notice a small metal hatch under the desk',
    'You opened the hatch and you fell into what seemed like an underground tunnel and you proceed to walk forward because that is the only way you can go',
    'b3')
living = DarkRoom('living Room', 'You are in the living room', 'lr')

helipad.add_connection(staircase, "staircase", ["east", "e"])
staircase.add_connection(hallway, "dark and quiet hallway", ["west", "w"])

hallway.add_connection(lobby, "lobby entirely full of zombies", ["north", "n"])
lobby.add_connection(
    kitchen,
    "large metal kitchen door that seems to be blocked off from the other side",
    ["south", "s"])
kitchen.add_connection(ceo_office,
                       "office that belongs to the CEO of the building",
                       ["west", "w"])
ceo_office.add_connection(trapdoor, "You teleport back to the helipad",
                          ["east", "e"])
trapdoor.add_connection(living, "You are here boy", ["east", "e"])

current_room = helipad
コード例 #3
0
from room import Room

northwest1 = Room('northwest1', 'You are in north west section #1.', 'nw1')
northwest2 = Room('northwest2', 'You are in north west section #2.', 'nw2')
northeast1 = Room('northeast1', 'You are in north east section #1.', 'ne1')
northeast2 = Room('northeast2', 'You are in north east section #2.', 'ne2')
southeast1 = Room('southeast1', 'You are in south east section #1.', 'se1')
southeast2 = Room('southeast2', 'You are in south east section #2.', 'se2')
southwest1 = Room('southwest1', 'You are in south west section #1.', 'sw1')
southwest2 = Room('southwest2', 'You are in south west section #2.', 'sw2')
north = Room('north', 'You are in the north section.', 'n')
south = Room('south', 'You are in the south section.', 's')
east = Room('east', 'You are in the east section.', 'e')
west = Room('west', 'You are in the west section.', 'w')

northwest1.add_connection(northwest2, "passage", ["northwest", "nw"])
northwest1.add_connection(northeast1, "passage", ["east", "e"])
northwest1.add_connection(southwest1, "passage", ["south", "s"])
northwest1.add_connection(west, "passage", ["southwest", "sw"])
northwest1.add_connection(north, "passage", ["northeast", "ne"])
northwest2.add_connection(west, "passage", ["south", "s"])
northwest2.add_connection(north, "passage", ["east", "e"])
northwest2.add_connection(northwest1, "passage", ["southeast", "se"])

kitchen.add_connection(hallway, "passage", ["north", "n"])


current_room = northwest1
while True:
    current_room.enter_room()
    command = raw_input("What direction do you want to go?")