Exemplo n.º 1
0
def CreateRoom4(roomSimple, map):
    roomSimple.BuildRoom(12, 12, 1, 6)

    # East Door
    portal = Room.Portal()
    portal.startPosition = 5
    portal.size = 2
    portal.destination = (0, 2, 11, 3)
    roomSimple.wall[1].portalList = [portal]
    roomSimple.wall[1].UpdatePortalRange()

    # North door
    portal = Room.Portal()
    portal.startPosition = 5
    portal.size = 2
    portal.destination = (0, 3, 0, -11)
    roomSimple.wall[0].portalList = [portal]
    roomSimple.wall[0].UpdatePortalRange()

    roomSimple.SetRoomID(4, map)

    #Add a Rug
    rug = RoomFeature.Feature()
    rug.CreateRug(1)
    rug.SetPosition(2, 3)
    roomSimple.AddFeature(rug)
Exemplo n.º 2
0
def test_room_paths():
	center = Room("Center", "Test room is the center.")
	north = Room("South", "Test room in the north.")
	south = Room("South", "Test room in the south.")
	center.add_paths({'north':north, 'south':south})
	assert_equal(center.go('north'), north)
	assert_equal(center.go('south', south))
Exemplo n.º 3
0
def CreateRoom2(roomSimple, map):
    roomSimple.BuildRoom(10,7,4,16)
    portal = Room.Portal()
    portal.startPosition = 2
    portal.size = 2
    portal.destination = (0,4,-11,-3)
    roomSimple.wall[3].portalList = [portal]
    roomSimple.wall[3].UpdatePortalRange()
    roomSimple.SetRoomID(2,map)


    portal = Room.Portal()
    portal.startPosition = 2
    portal.size = 2
    portal.destination = (0,5,9,-3)
    roomSimple.wall[1].portalList = [portal]
    roomSimple.wall[1].UpdatePortalRange()

    #Add a staircase
    stairs = RoomFeature.Feature()
    stairs.CreateStaircase(0)
    stairs.SetPosition(2,3)
    stairs.FeatureBlocks[2].EffectData = (1,2,1) # Room, OffsetX, offsety    
    stairs.FeatureBlocks[5].EffectData = (1,2,1) # Room, OffsetX, offsety    
    roomSimple.AddFeature(stairs)
Exemplo n.º 4
0
    def get_current_room(self):
        room_path = self.world_folder + "/rooms/room_{}_{}.json".format(
            int(self.current_room.x), int(self.current_room.y))
        if not os.path.isfile(room_path):
            Room.ScreenGenerator(self.current_room.copy(), self)

        room_file = open(room_path, "rb")
        room_json = room_file.read()
        room_file.close()

        room_data = json.loads(room_json)

        room_map = room_data["map"]
        room_objects = room_data["objects"]
        room_connections = room_data["connections"]
        new_room_objects = []
        for obj in range(0, len(room_objects)):
            obj_to_add = ObjectUnpacker.unpack(room_objects[obj], self.camera)
            if isinstance(obj_to_add, Object):
                new_room_objects.append(obj_to_add)
        room_objects = new_room_objects

        room_renderer = Room.RoomRenderer(room_map,
                                          "game_data/tileset/tileset1",
                                          objects=room_objects,
                                          camera=self.camera,
                                          connections=room_connections)
        room_renderer.fix()
        room_renderer.render()
        self.save_room()
        self.current_room_obj = room_renderer

        return room_renderer
Exemplo n.º 5
0
 def __init__(self, cam_resolution, camera_number, horizontal_sect,
              vertical_sect, white_level, person_ammount, new_person_tresh,
              sleep_period_value):
     print " analysis"
     #podzial sceny na sektory
     self.note_file_url = "results/results"
     self.cam_resolution = cam_resolution
     self.camera_number = camera_number
     self.white_level = white_level
     self.person_ammount = person_ammount
     self.sectors = []
     self.sleep_period_value = sleep_period_value
     row = []
     self.persons = []
     miny_x = range(0, cam_resolution[0],
                    cam_resolution[0] / horizontal_sect)
     maksy_x = range(cam_resolution[0] / horizontal_sect,
                     (cam_resolution[0] / horizontal_sect *
                      (horizontal_sect + 1)),
                     cam_resolution[0] / horizontal_sect)
     miny_y = range(0, cam_resolution[1], cam_resolution[1] / vertical_sect)
     maksy_y = range(cam_resolution[1] / vertical_sect,
                     (cam_resolution[1] / vertical_sect *
                      (vertical_sect + 1)),
                     cam_resolution[1] / vertical_sect)
     for i in range(vertical_sect):
         miny, maksy = miny_y[i], maksy_y[i]
         for column in range(horizontal_sect):
             minx, maksx = miny_x[column], maksy_x[column]
             row.append((minx, miny, maksx, maksy))
         self.sectors.append(row)
     self.room = Room(person_ammount, new_person_tresh)
     f = open(self.note_file_url, "w")
     f.close()
Exemplo n.º 6
0
def BSP(ws: np.mat) -> None:
    # print("BSP : ", ws.shape)
    height, width = ws.shape
    bsp = tcod.bsp.BSP(x=2, y=2, width=width - 4, height=height - 4)
    bsp.split_recursive(
        # depth=randint(10, 15)
        depth=6,
        min_width=1,
        min_height=1,
        max_horizontal_ratio=1.5,
        max_vertical_ratio=1.5,
    )

    # In pre-order, leaf nodes are visited before the nodes that connect them
    for node in bsp.pre_order():
        if node.children:
            node1, node2 = node.children
            Room.connect_rooms(ws, node1, node2)
        else:

            # Room Too Big, Split Further
            limit = 6
            if node.width > width//limit and node.height > height//limit and node.width > 3 and node.height > 3:
                BSP(ws[node.y + 1:node.y + node.height - 1, node.x + 1: node.x + node.width - 1])
            else:  # Dig out room
                Room.create_room(ws, node)
Exemplo n.º 7
0
def test_room_paths():
    center = Room("Center", "Test room in the center.")
    north = Room("North", "Test room in the north.")
    south = Room("South", "Test room in the south.")

    cent.add_paths({'north': north, 'south': south})
    assert_equal(center.go('north'), north)
    assert_equal(center.go('south'), south)
Exemplo n.º 8
0
def switchRoom(d):
    oldRoom = d["currentRoom"]
    player = Room.getPlayer(oldRoom)
    x, y = Entity.getPosition(player)

    if x < 2 or x > 77 or y < 1 or y > 38:
        Room.removeEntity(oldRoom, player)

        if x < 2:
            setCurrentRoom(d, Room.getLeftRoom(oldRoom))
            x = 77

        if x > 77:  # Taille max en x des salles
            setCurrentRoom(d, Room.getRightRoom(oldRoom))
            x = 2

        if y < 1:
            setCurrentRoom(d, Room.getUpRoom(oldRoom))
            y = 38

        if y > 38:  # Taille max en y des salles
            setCurrentRoom(d, Room.getDownRoom(oldRoom))
            y = 1

        Entity.setPosition(player, x, y)
        Room.addEntity(d["currentRoom"], player)
Exemplo n.º 9
0
 def __init__(self, agent):
     '''
     Constructor
     '''
     self.r1 = Room.Room('A', 'dirty')
     self.r2 = Room.Room('B', 'dirty')
     self.agent = agent
     self.currentRoom = self.r1
     self.delay = 1000
     self.step = 1
     self.action = ""
Exemplo n.º 10
0
    def __init__(self, radius):
        self.radius = radius

        self.room_grid = [[0 for i in range(radius * 2 - 1)]
                          for j in range(radius * 2 - 1)]

        self.doorgrid = [[[0, 0, 0, 0] for i in range(radius * 2 - 1)]
                         for j in range(radius * 2 - 1)]
        diam = radius * 2 - 1

        for i in range(-radius + 1, radius):
            for j in range(-radius + 1, radius):
                value = ((i)**2 + (j)**2)**(1 / 2)
                if value <= radius - 1:
                    self.room_grid[i + radius - 1][j + radius - 1] = Room(
                        i + radius - 1, j + radius - 1, [])

        room_starter = self.room_grid[radius - 1][radius - 1]

        for i in range(diam):
            for j in range(diam):
                temp = self.room_grid[i][j]
                if type(temp) == type(Room(None, None, [])):
                    temp_right = None
                    temp_down = None
                    try:
                        if i + 1 < diam or i + 1 >= 0:
                            temp2 = self.room_grid[i + 1][j]
                    except Exception:
                        continue
                    try:
                        if j + 1 < diam or j + 1 >= 0:
                            temp3 = self.room_grid[i][j + 1]
                    except Exception:
                        continue

                    if type(temp2) == type(Room(None, None,
                                                [])) and random() > 0.2:
                        location = 1 + int(random() * 13)
                        temp.addDoor([3, location])
                        temp2.addDoor([2, location])
                    if type(temp3) == type(Room(None, None,
                                                [])) and random() > 0.2:
                        location = 1 + int(random() * 18)
                        temp.addDoor([1, location])
                        temp3.addDoor([0, location])

        self.connect_rooms()
        self.clear_unconnected()
        self.setRoomTypes()
        self.buildChests()
Exemplo n.º 11
0
class EnemyTests(unittest.TestCase):

    def setUp(self):
        self.player = Player("Obi")
        self.room = Room(self.player)

    def test_enemy_count(self):
        self.assertEqual(True, self.room.number_of_enemies > 0)

    def test_enemies(self):
        self.room.generate_enemies()
        self.assertEqual([], self.room.enemies)

    def test_room_knows_player_name(self):
        self.assertEqual("Obi", self.room.player.name)

    def test_treasure_chest_starts_with_0(self):
        self.assertEqual(0, self.room.treasure_chest)

    def test_add_gold_to_chest(self):
        self.room.add_gold_to_treasure_chest()
        self.room.add_gold_to_treasure_chest()
        self.assertEqual(True, self.room.treasure_chest >= 20)

    def test_treasure_chest_looting(self):
        self.room.add_gold_to_treasure_chest()
        self.room.loot_treasure_chest()
        self.assertEqual(True, self.room.player.goldPouch > 9)
        self.assertEqual(0, self.room.treasure_chest)
def room_4_state_5():
    ''' room 4 state 5 '''
    Game1.introduction()
    print(Room.load_room_4_description_2())
    print(room_ascii.room_4_state_4())
    print(Room.load_room_4_description_3())
    command = prompt()
    if command == "q" or command == "quit":
        print("Quitting the game, hope you had fun!")
        Game1.emptyInventory()
        sys.exit()
    elif command == "h" or command == "help":
        Game1.help_choice()
        print()
        print("______________________________________________")
        room_4_state_5()
    elif command == "inv" or command == "inventory":
        Game1.inv()
        room_4_state_5()
    elif command == "fw" or command == "forward" or command == "cheat" or command == "ready":
        print("The fairy snaps her fingers and casts her spell")
        print("______________________________________________")
        room_5_state_0()
    elif command == "bw" or command == "backwards":
        print("Taking one step back...")
        print("______________________________________________")
        Game4.backwards()
        Game1.addItem("boots")
        room_4_state_4()
    elif command in Game1.always_available_options()[:]:
        print(Game4.respond_options_state_5(command))
        print()
        print("______________________________________________")
        room_4_state_5()
    elif command.split(' ', 1)[0] in Game1.object_options()[:]:
        try:
            Game4.respond_object_options_state_5(command)
            print()
            print("______________________________________________")
            room_4_state_5()
        except IndexError:
            print("This command needs to be used with an object")
            print("______________________________________________")
            room_4_state_5()
    elif command not in Game1.always_available_options(
    )[:] or command not in Game1.object_options()[:]:
        print("Thats not a valid choice")
        print()
        print("______________________________________________")
        room_4_state_5()
Exemplo n.º 13
0
    def setRoomTypes(self):
        maxDist = 0
        mdi = -1
        mdj = -1

        for i in range(len(self.room_grid)):
            for j in range(len(self.room_grid)):
                if type(self.room_grid[i][j]) == type(Room(None, 0, 0)):
                    if (i == self.radius - 1 and j == self.radius - 1):
                        self.room_grid[i][j].setRoomType("Base")
                    elif (i == 0 or j == 0 or i == self.radius * 2 - 2
                          or j == self.radius * 2 - 2):
                        self.room_grid[i][j].setRoomType("Boss")
                    elif random() > 0.3:
                        self.room_grid[i][j].setRoomType("Enemy")

                    temp_dist = self.room_grid[i][j].getDist()

                    if temp_dist > maxDist:

                        maxDist = temp_dist
                        mdj = i
                        mdi = j

        self.room_grid[mdj][mdi].setRoomType("Exit")
Exemplo n.º 14
0
    def generate(self):
        last = -1

        def opp(dir):
            if dir == 0:
                return 2
            if dir == 2:
                return 0
            if dir == 1:
                return 3
            if dir == 3:
                return 1

        for i in range(self.noOfRooms - 1):
            direction = random.randrange(0, 4)
            while (last == opp(direction)):
                direction = random.randrange(0, 4)
            if (direction == 0):
                self.roomConnections[i] = [
                    i, i + 1, 0
                ]  # 0 -> bottom to top    1 -> left to right
            elif (direction == 1):
                self.roomConnections[i] = [i, i + 1, 1]
            elif (direction == 2):
                self.roomConnections[i] = [i + 1, i, 0]
            elif (direction == 3):
                self.roomConnections[i] = [i + 1, i, 1]
            last = direction

        for i in range(self.noOfRooms):
            self.rooms[i] = Room(i, random.randrange(0, len(RoomTypes)),
                                 self.lvl)
            self.rooms[i].generate()
Exemplo n.º 15
0
    def __init__(self, width, height, mapSize, roomNum):
        self.width = width
        self.height = height

        #iterate over the map and fill it with wall tiles
        # self._map = ["-" for i in xrange(0, width * height)]
        # self._map = ["◊" for i in xrange(0, width * height)]
        self._map = [" " for i in xrange(0, width * height)]

        self.mapSize = mapSize

        hallwayDist = MAX_DIST_FOR_HALLWAYS.get(self.mapSize, 40)
        # self.roomNum = roomNum
        # roomDims = DimRange(roomMin, roomMin, roomMax, roomMax)
        # self.roomDims = roomDims

        self.rooms = [Room(self, ROOM_DIMS)] * roomNum

        for i in xrange(0, roomNum):
            self.rooms[i].myIndex = i
            #print "Testing to see if room: %d intersects with another room" %i
            while (self.isRoomIntersectingAnotherRoom(i)):
                self.rooms[i] = self.RollRoom(i)

        self.proximities = []
        self.buildAndSortProximities()

        self.hallways = []
        self.makeHallways(hallwayDist)
Exemplo n.º 16
0
 def __init__(self):
     self.lifes = 3
     self.hungover = True
     self.key = False
     self.earring = False
     self.map = False
     self.location = Room.Cabin()
Exemplo n.º 17
0
    def __init__(self):
        Room.__init__(self)
 
        walls = [[0, 0, 20, 250, RED],
                 [0, 350, 20, 250, RED],
                 [780, 0, 20, 250, RED],
                 [780, 350, 20, 250, RED],
                 [20, 0, 760, 20, RED],
                 [20, 580, 760, 20, RED],
                 [190, 50, 20, 500, GREEN],
                 [590, 50, 20, 500, GREEN]
                ]
 
        for item in walls:
            wall = Wall(item[0], item[1], item[2], item[3], item[4])
            self.wall_list.add(wall)
 def select_rooms(self):
     self._c.execute("SELECT * FROM room")
     rooms = self._c.fetchall()
     returnRooms = []
     for i in range(0, len(rooms)):
         returnRooms.append(Room.Room(rooms[i][0], rooms[i][1]))
     return returnRooms
Exemplo n.º 19
0
 def clear_unconnected(self):
     for i in range(len(self.room_grid)):
         for j in range(len(self.room_grid)):
             if type(self.room_grid[i][j]) == type(
                     Room(None, None,
                          [])) and not self.room_grid[i][j].connected:
                 self.room_grid[i][j] = 0
Exemplo n.º 20
0
def init_room(data):
    """
    Returns a room built with the room json data.
    args:
        data (dict): structure that contains all room data
    """
    name = data['room_name']
    long_intro = data['long_intro']
    short_intro = data['short_intro']
    long_exit = data['long_exit']
    north = data['north']
    south = data['south']
    east = data['east']
    west = data['west']
    features = init_room_features(name, data)
    objects = init_room_objects(data)
    north_exits = init_list(data['north_exits'])
    south_exits = init_list(data['south_exits'])
    east_exits = init_list(data['east_exits'])
    west_exits = init_list(data['west_exits'])
    room_type = data['room_type']
    restricted = data['restricted']

    room = Room(name, long_intro, short_intro, long_exit, north, south, east,
                west, features, objects, north_exits, south_exits, east_exits,
                west_exits, room_type, restricted)

    return room
Exemplo n.º 21
0
 def __init__(self,cam_resolution, camera_number,  horizontal_sect,  vertical_sect, white_level,  person_ammount, new_person_tresh, sleep_period_value):
     print " analysis"
     #podzial sceny na sektory
     self.note_file_url = "results/results"
     self.cam_resolution = cam_resolution
     self.camera_number = camera_number
     self.white_level = white_level
     self.person_ammount = person_ammount
     self.sectors = []
     self.sleep_period_value =sleep_period_value
     row =[]
     self.persons =[]
     miny_x = range(0, cam_resolution[0], cam_resolution[0]/horizontal_sect)
     maksy_x = range(cam_resolution[0]/horizontal_sect,  (cam_resolution[0]/horizontal_sect*(horizontal_sect+1)),  cam_resolution[0]/horizontal_sect)
     miny_y = range(0,cam_resolution[1] , cam_resolution[1] /vertical_sect)
     maksy_y = range(cam_resolution[1]/vertical_sect,  (cam_resolution[1]/vertical_sect*(vertical_sect+1)),  cam_resolution[1]/vertical_sect )
     for i in range(vertical_sect):
         miny,  maksy= miny_y[i], maksy_y[i]
         for column in range(horizontal_sect):
             minx,  maksx = miny_x[column],  maksy_x[column]
             row.append((minx, miny, maksx,  maksy))
         self.sectors.append(row)
     self.room = Room(person_ammount, new_person_tresh)
     f= open(self.note_file_url, "w")
     f.close()
Exemplo n.º 22
0
def test():
    import Room
    ### remove the monotany of recreating player name every time
    # link = create_player()
    link = Hero("linko")
    enemy = Room.create_opponent()
    zelda_battle(link, enemy)
def room_5_state_0():
    ''' POOF state room 5 '''
    print(room_ascii.room_5_state_1())
    time.sleep(2)
    Game1.addItem("ring")
    print(Room.load_room_5_description_2())
    room_5_state_1()
Exemplo n.º 24
0
 def __init__(self, width, height):
     self.username = "******"
     self.rooms = []
     self.player = Player()
     
     self.rooms.append(Room(width, height, self.player))
     self.currentRoom = self.rooms[0]
Exemplo n.º 25
0
    def __init__(self, wielkosc_mapygen=None):
        global ile_map
        global wybrana

        # tworzenie mapy gry
        if wielkosc_mapygen is not None:
            wielkosc_mapy = [0] * wielkosc_mapygen.get()
        else:
            wielkosc_mapy = [0] * random.randint(7, 14)

        wybrana = wielkosc_mapy
        self.mapa = []  # ATR: MAPA
        for i in range(len(wielkosc_mapy)):
            self.mapa.append(wielkosc_mapy[:])

        self.list_of_item_pokoi = [
            Room.Pokoj() for i in range(len(wielkosc_mapy)**2)
        ]  # ATR: list_of_item_POKOI
        k = 0
        for i in range(len(wielkosc_mapy)):
            for j in range(len(wielkosc_mapy)):
                self.mapa[i][j] = self.list_of_item_pokoi[k]
                if random.choice(prawda_falsz):
                    self.mapa[i][j].otwarty = True
                    if random.choice(prawda_falsz):
                        self.mapa[i][j].event = True
                else:
                    self.mapa[i][j].otwarty = False
                k += 1
        self.mapa[len(wielkosc_mapy) - 1][len(wielkosc_mapy) -
                                          1].otwarty = True
Exemplo n.º 26
0
 def testSetRoomName(self):
     """
     Prueba unitaria para setRoomName.
     """
     self.room = Room.Room("Nueva", "Teresa")
     self.assertEqual("Nueva", self.room.getRoomName())
     self.room.setRoomName("Prueba")
     self.assertEqual("Prueba", self.room.getRoomName())
Exemplo n.º 27
0
 def testGetUsersInRoom(self):
     """
     Prueba unitaria para getUsersInRoom.
     """
     self.room6 = Room.Room("Nueva", "Marco")
     self.assertEqual([], self.room6.getUsersInRoom())
     self.room6.addUsersInRoom("Daniel")
     self.assertEqual(["Daniel"], self.room6.getUsersInRoom())
Exemplo n.º 28
0
 def testAddUsersInRoom(self):
     """
     Prueba unitaria para addUsersInRoom.
     """
     self.room4 = Room.Room("Nueva", "Luci")
     self.assertEqual([], self.room4.getUsersInRoom())
     self.room4.addUsersInRoom("Enrique")
     self.assertEqual(["Enrique"], self.room4.getUsersInRoom())
Exemplo n.º 29
0
 def testGetRoomName(self):
     """
     Prueba unitaria para getRoomName.
     """
     self.room1 = Room.Room("Nueva1", "Carmen")
     self.assertEqual("Nueva1", self.room1.getRoomName())
     self.room1.setRoomName("Prueba1")
     self.assertEqual("Prueba1", self.room1.getRoomName())
Exemplo n.º 30
0
 def __init__(self):
     self.room_class = r.Room()
     self.map = [[self.room_class.all_rooms.get("Vestibule")]]
     self.main_room = (0, 0)
     self.difficulty_level = d.All_Difficulties().difficulties.get("Normal") # random diff for now 
     self.player_list = [h.HeroesCards.aelfric, h.HeroesCards.cecilia, h.HeroesCards.tetemeko] # random players for now 
     self.current_player = self.player_list[0]
     self.map[0][0].players = self.player_list
Exemplo n.º 31
0
 def changeroom(self, nextroom):
     print(nextroom + " test1")
     if nextroom == 'káeta':
         self.location = Room.Cabin()
         return self.location.whereami()
     elif nextroom == 'bar':
         self.location = Room.Bar()
         return self.location.whereami()
     elif nextroom == 'strönd':
         self.location = Room.Beach()
         return self.location.whereami()
     elif nextroom == 'skógur':
         if self.map:
             self.location = Room.Forrest()
             return self.location.whereami()
     else:
         return 'Þetta er ekki lögleg staðseting'
Exemplo n.º 32
0
def CreateRoom5(roomSimple, map):
    roomSimple.BuildRoom(9, 9, 2, 7)
    roomSimple.SetRoomID(5, map)

    portal = Room.Portal()
    portal.startPosition = 5
    portal.size = 2
    portal.destination = (0, 2, -9, 3)
    roomSimple.wall[3].portalList = [portal]
    roomSimple.wall[3].UpdatePortalRange()

    portal = Room.Portal()
    portal.startPosition = 4
    portal.size = 2
    portal.destination = (0, 6, 0, -10)
    roomSimple.wall[0].portalList = [portal]
    roomSimple.wall[0].UpdatePortalRange()
Exemplo n.º 33
0
def Room2D():
    global totRooms
    from gpiozero import LED
    LED(12).on()
    totRooms += 1
    intStations = [0]
    points2D = 360
    with open('outfile.json') as json_file:
        data = json.load(json_file)
        for area in data['areas']:
            if area['id'] == 'R' + str(totRooms):
                roomname = area['room']
                stationname = area['stations']
                note = area['notes']
    activeroomtxt.configure(text='Active Room: ' + roomname)
    stationlabel.configure(text='Station: ' + stationname)
    stationnotes.configure(text='Note: ' + note)
    window.update()
    room = Room(roomname, totRooms, intStations)
    room.room2DScan(points2D)
    if activeStation >= 0:
        xoff = stations[activeStation].x * -1
        yoff = stations[activeStation].y * -1
        room.rotate2Ddata(stations[activeStation].quatw,
                          stations[activeStation].quatx,
                          stations[activeStation].quaty,
                          stations[activeStation].quatz)
    else:
        xoff = 0
        yoff = 0
    print(len(room.x2d))
    room.addOffset2D(xoff, yoff)
    room.showRoom(rooms)
    rooms.append(room)
    with open('outfile.json') as out_file:
        data = json.load(out_file)
        for area in data['areas']:
            if area['id'] == 'R' + str(totRooms):
                area['x2d'] = room.x2d
                area['y2d'] = room.y2d
    window.update()
    os.remove('outfile.json')
    with open('outfile.json', 'w') as out_file:
        json.dump(data, out_file, indent=4)
    print(rooms)
    LED(12).off()
Exemplo n.º 34
0
    def __init__(self):
        Room.__init__(self)
        # Make the walls. (x_pos, y_pos, width, height)
 
        # This is a list of walls. Each is in the form [x, y, width, height]
        walls = [[0, 0, 20, 250, WHITE],
                 [0, 350, 20, 250, WHITE],
                 [780, 0, 20, 250, WHITE],
                 [780, 350, 20, 250, WHITE],
                 [20, 0, 760, 20, WHITE],
                 [20, 580, 760, 20, WHITE],
                 [390, 50, 20, 500, BLUE]
                ]
 
        # Loop through the list. Create the wall, add it to the list
        for item in walls:
            wall = MyWall(item[0], item[1], item[2], item[3], item[4])
            self.wall_list.add(wall)
Exemplo n.º 35
0
def test_room_paths():
	center = Room("Center", "Test room in the center")
	north = Room("North", "Test room in the north")
	south = Room("South", "Test room in the south")
	
	center.add_paths({'north': north, 'south': south})
	assert_equal(center.go('north', north)
	assert_equal(center.go('south', south)
	
def test_map():
	start = Room("Start", "You can go west and down a hole.")
	west = Room("Trees", "There are trees here, you can go east.")
	down = Room("Dungeon", "It's dark down here, you can go up.")
	
	start.add_paths({'west': west, 'down': down})
	west.add_paths({'east': start})
	down.add_paths({'up': start})
	
	assert_equal(start.go('west'), west)
	assert_equal(start.go('west').go('east'), start)
	assert_equal(start.go('west'),go('up'), start)
Exemplo n.º 36
0
    def __init__(self):
        Room.__init__(self)
 
        walls = [[0, 0, 20, 250, PURPLE],
                 [0, 350, 20, 250, PURPLE],
                 [780, 0, 20, 250, PURPLE],
                 [780, 350, 20, 250, PURPLE],
                 [20, 0, 760, 20, PURPLE],
                 [20, 580, 760, 20, PURPLE]
                ]
 
        for item in walls:
            wall = MyWall(item[0], item[1], item[2], item[3], item[4])
            self.wall_list.add(wall)
 
        for x in range(100, 800, 100):
            for y in range(50, 451, 300):
                wall = MyWall(x, y, 20, 200, RED)
                self.wall_list.add(wall)
 
        for x in range(150, 700, 100):
            wall = MyWall(x, 200, 20, 200, WHITE)
            self.wall_list.add(wall)
Exemplo n.º 37
0
	def initUI(self,name, parent, tracker):
        #parsePlantXML(name)
		#FOR TESTING PURPOSES ONLY!!!!!
		roomList = []
		if (name == "Floor 1"):
			roomList = ["Room 1","Room 2","Room 3"]
		elif (name == "Floor 2"):
			roomList = ["Room 4","Room 5","Room 6"]
		else:
			roomList = ["Room 7","Room 8","Room 9"]

		grid = QtGui.QGridLayout()
		grid.setSpacing(10)
		grid.setVerticalSpacing(20)
		
        #floorList is returned by xml parser --> ["Floor 1","Floor 2",...]
        #create instances of FloorButton (extends AbstractButton) from floorList
		for i in range(len(roomList)):
			
			theRoom = Room(roomList[i],self,self.tracker)#QtGui.QGroupBox(roomList[i]) #should be Room()
			theRoomButton = RoomButton(roomList[i], self, theRoom)
			theRoom.addButton(theRoomButton)

			self.roomButtonList.append(theRoomButton) #abstract button --> FloorButton
			self.roomObjectList.append(theRoom)
			
		for k in range(len(self.roomButtonList)):
			grid.addWidget(self.roomButtonList[k], 0, k)
		#Comment after testing!!!!!
		for k in range(len(self.roomObjectList)):
			grid.addWidget(self.roomObjectList[k], 1, 0, 1, len(self.roomButtonList))
		self.setLayout(grid)
		# self.setGeometry(300, 300, 350, 300)
		# self.show()  
		self.setStyleSheet(""".Floor { background-color: white; font-size: 10px; border-radius: 6px} 
			.Floor::title { color: transparent; background-color: transparent; padding-top: 5px; padding-left: 5px; }""")
Exemplo n.º 38
0
 def load_game_world(self):
     stairwell = Room("../data/mod/jcmbstairs.egg")
     stairwell.add_all_visibles_and_collidables(render, self.bullet_world)
Exemplo n.º 39
0
	def __init__(self):
		yaml_path = 'config/airplane_1_alpha.yaml'
		self.rooms = {}
		self.abilities = []
		self.ability_dict = {}
		self.enemies = {}
		room_data = yaml.load_all( open(yaml_path, 'r') )
	
		### Load map data
		print "Loading map file..."
		for d in room_data:
			newroom = Room()
			newroom.setDescription(d['description'])
			directional_descs = [d['look_north'], d['look_south'], d['look_east'], d['look_west']]
			newroom.setDirectionalDescriptions(directional_descs)
			## Check for alt descriptions
			if 'look_alt_north' in d.keys():
				newroom.setAltDesc('north', d['look_alt_north'])	
				newroom.setAltDescBool('north', False)
			if 'look_alt_south' in d.keys():
				newroom.setAltDesc('south', d['look_alt_south'])	
				newroom.setAltDescBool('south', False)	
			if 'look_alt_east' in d.keys():
				newroom.setAltDesc('east', d['look_alt_east'])	
				newroom.setAltDescBool('east', False)	
			if 'look_alt_west' in d.keys():
				newroom.setAltDesc('west', d['look_alt_west'])	
				newroom.setAltDescBool('west', False)
			moves = [d['north'], d['south'], d['east'], d['west']]
			newroom.setDirectionalMoves(moves)
			self.rooms[(d['x'],d['y'])] = newroom
			room_items = []
			for item in d['items']:
				new_obj = InteractiveObject()
				new_obj.setName(item['name'])
				new_obj.setItems(item['item_list'])
				new_obj.setUnlockItems(item['unlock_item'])
				if len(new_obj.getUnlockItems()) > 0:
					new_obj.setUnlockText(item['unlock_text'])
				new_obj.setKeywords(item['keyword'])
				new_obj.setDirectionToChange(item['map_side_to_change'])
				new_obj.setExamineText(item['examine_text'])
				new_obj.setEquippable(item['equippable'])
				if new_obj.getEquippable():
					new_obj.setStrength(item['strength'])
					new_obj.setIntellect(item['intellect'])
				# Alt text to change
				if 'alt_text_dir' in item.keys():
					new_obj.setAltDescDirection(item['alt_text_dir'])	
				## Droppable items, if any
				d_items = []
				for d_item in item['droppable_items']:
					d_obj = InteractiveObject()
					d_obj.setName(d_item['name'])
					d_obj.setItems(d_item['item_list'])
					d_obj.setUnlockItems(d_item['unlock_item'])
					if len(d_obj.getUnlockItems()) > 0:
						d_obj.setUnlockText(d_item['unlock_text'])
					d_obj.setKeywords(d_item['keyword'])
					d_obj.setDirectionToChange(d_item['map_side_to_change'])
					d_obj.setExamineText(d_item['examine_text'])
					d_obj.setEquippable(d_item['equippable'])
					if d_obj.getEquippable():
						d_obj.setStrength(d_item['strength'])
						d_obj.setIntellect(d_item['intellect'])
					d_items.append(d_obj)
				new_obj.setDroppableItems(d_items)
				room_items.append(new_obj)		
			newroom.setItems(room_items)
			newroom.setEnemies(d['enemies'])
		print "Map file loaded!"
	
		### Load ability data	
		ability_yaml_path = 'config/ability_bank.yaml'
		ability_data = yaml.load_all( open(ability_yaml_path, 'r') )
		for a in ability_data:
			new_a = Ability()
			new_a.setName(a['name'])
			new_a.setLevelReq(a['level_req'])
			new_a.setDamage(a['damage'])
			new_a.setForPlayer(a['for_player'])
			self.ability_dict[a['id']] = new_a
			#self.abilities.append(new_a)

		### Load enemy data
		enemy_yaml = 'config/enemies.yaml'
		enemy_data = yaml.load_all( open(enemy_yaml, 'r') )
		for e in enemy_data:
			new_e = Enemy()
			id = e['id']
			#new_e.setPos((e['x'], e['y']))
			new_e.setName(e['name'])
			new_e.setHP(e['hp'])	
			new_e.setMP(e['mp'])
			new_e.setXP(e['xp'])
			for a_id in e['abilities']:
				new_e.addAbility(self.ability_dict[a_id])
			self.enemies[id] = new_e
Exemplo n.º 40
0
import Room

central_corridor = Room("Central Corridor",
"""
The Gothons of Planet Percal #25 have invaded your ship and destroyed
your entire crew.  You are the last surviving member and your last
mission is to get the neutron destruct bomb from the Weapons Armory,
put it in the bridge, and blow the ship up after getting into an
escape pod.

You're running down the central corridor to the Weapons Armory when
a Gothon jumps out, red scaly skin, dark grimy teeth, and evil clown costume
flowing around his hate filled body.  He's blocking the door to the
Armory and about to pull a weapon to blast you.
""")


laser_weapon_armory = Room("Laser Weapon Armory",
"""
Lucky for you they made you learn Gothon insults in the academy.
You tell the one Gothon joke you know:
Lbhe zbgure vf fb sng, jura fur fvgf nebhaq gur ubhfr, fur fvgf nebhaq gur ubhfr.
The Gothon stops, tries not to laugh, then busts out laughing and can't move.
While he's laughing you run up and shoot him square in the head
putting him down, then jump through the Weapon Armory door.

You do a dive roll into the Weapon Armory, crouch and scan the room
for more Gothons that might be hiding.  It's dead quiet, too quiet.
You stand up and run to the far side of the room and find the
neutron bomb in its container.  There's a keypad lock on the box
and you need the code to get the bomb out.  If you get the code
Exemplo n.º 41
0
    def createWorld(self):
        # Criando as salas...
        salaMisteriosa = Room(
            "sala misteriosa",
            "Você abre os olhos devagar, sua visão ainda embaçada consegue identificar que"
            + " você encontra-se em um salão tão brilhante quanto ouro. Ao seu lado você percebe uma silhueta de um homem vestido em uma"
            + " armadura e segurando o que parece ser uma lança... Ele dirigi-se à você...",
        )
        cabana = Room(
            "cabana",
            "Você acorda assustado e suando. Olha ao redor e encontra suas roupas penduradas na parede, sua cama"
            + " e seu machado e escudo pendurados na parde de madeira, logo ao lado uma porta... Você então se dá conta de que"
            + " está em sua cabana e que tudo não passou de um sonho.",
        )
        cozinha = Room(
            "cozinha",
            "Entrando na cozinha, você já está familiarizado com sua velha dispensa, sua pequena mesa  e sobre ela o"
            + " que restou da caça de ontem e uma pequena runa. Além disso, a parte mais importante, seu trófeu da primeira caçada ao lado"
            + " de seu pai.",
        )
        dispensa = Room("dispensa", "um armário antigo com algumas frutas")
        cama = Room("cama", "cama de feno e pedaços de pele de animais. Muito usada nesses tempos...")
        arredoresDeSiegheim1 = Room(
            "arredores de Siegheim",
            " ao sair da sua cabana, você se encontra nas florestas que rodeiam as ruinas de"
            + " Siegheim(nome da cidade principal dos dominios do rei ragnar)",
        )
        arredoresDeSiegheim2 = Room(
            "arredores de Siegheim",
            " andando pelo caminho, você lembra dos passeios com seu pai por essas mesmas florestas."
            + " Olhando ao redor você observa alguns cogumelos e lembra dos ensinamentos de seu pai, explicando os efeitos de cada planta nas florestas.",
        )
        arredoresDeSiegheim3 = Room(
            "arredores de Siegheim",
            " seguindo frente você se depara com uma bifurcação no caminho. Você acha estranho,"
            + " pois o caminho havia se alterado repentinamente.",
        )
        arredoresDeSiegheim4 = Room(
            "arredores de Siegheim",
            " você anda com desconfiança pela floresta desconhecida. Ao longe observa-se uma slhueta de uma pessoa.",
        )
        eremita = Room(
            "velho eremita misterioso",
            "Aproximando-se, a silhueta toma a forma de um senhor de idade. Enquanto você passa ele joga pragas"
            + " aos ventos. No momento em que ele o vê, os olhos do eremita se enchem de raiva. O senhor começa a esbravejar insunuações sobre o seu pai ter"
            + " sido a ruína dos bárbaros. Logo após ele corre em direção a mata dansa e nebulosa.",
        )
        arredoresDeSiegheim5 = Room(
            "arredores de Siegheim",
            " com o tempo você começa a reconhecer o caminho. Lembra que havia uma cicatriz naquela árvore."
            + " a partir desse momento você se dá conta de que se aproxima das ruínas do palácio.",
        )

        # Adicionando as segundas descrições
        cabana.setDescription2(" seu quarto, nele você pode ver sua cama e algumas coisas comuns")
        cozinha.setDescription2(" sua cozinha. Você pode ver sua dispensa e mesa.")
        dispensa.setDescription2(" armário antigo")
        cama.setDescription2(" sua cama")
        arredoresDeSiegheim1.setDescription2(" arredores de sigheim, próxima a sua cabana.")
        arredoresDeSiegheim2.setDescription2(" arredores de Siegheim, essa área possui várias plantas medicinais.")
        arredoresDeSiegheim3.setDescription2(" arredores de Siegheim, você se encontra na bifurcação estranha.")
        arredoresDeSiegheim4.setDescription2(" arredores de Siegheim, local próximo ao seu encontro com o eremita.")
        arredoresDeSiegheim5.setDescription2(" arredores de Siegheim, você está mais próximo das ruínas.")
        eremita.setDescription2(" arredores de Siegheim, local exato onde você encontrou o eremita.")

        # Adicionando saídas as salas
        salaMisteriosa.setExits("correr", cabana)

        cabana.setExits("porta", cozinha)
        cabana.setExits("cama", cama)

        cozinha.setExits("porta", cabana)
        cozinha.setExits("dispensa", dispensa)
        cozinha.setExits("fora da cabana", arredoresDeSiegheim1)

        dispensa.setExits("cozinha", cozinha)

        cama.setExits("quarto", cabana)

        arredoresDeSiegheim1.setExits("cabana", cozinha)
        arredoresDeSiegheim1.setExits("continuar andando", arredoresDeSiegheim2)
        arredoresDeSiegheim2.setExits("voltar", arredoresDeSiegheim1)
        arredoresDeSiegheim2.setExits("seguir em frente", arredoresDeSiegheim3)
        arredoresDeSiegheim3.setExits("voltar", arredoresDeSiegheim2)
        arredoresDeSiegheim3.setExits("esquerda", arredoresDeSiegheim4)
        arredoresDeSiegheim3.setExits("direita", arredoresDeSiegheim5)
        arredoresDeSiegheim4.setExits("voltar", arredoresDeSiegheim3)
        arredoresDeSiegheim4.setExits("se aproximar da silhueta", eremita)
        arredoresDeSiegheim5.setExits("voltar", arredoresDeSiegheim3)

        # Criando itens
        bilhete = Item("bilhete", ' "Encontre-me nas ruinas do antigo rei,\nDe: Seu amigo\nPara: Sieg"')
        roupas = Item("roupas", "Roupas de couro de animais das redondezas, protegem bastante contra o frio")
        machado = Item("machado", "Um machado comum")
        escudo = Item("escudo", "Escudo de madeira feito pelo seu pai.")
        frutas = Item("frutas", "algumas frutas que sobraram antes do início do inverno.")
        simboloDeCaçada = Item(
            "Troféu",
            "A cabeça de um javali morto na sua primeira caçada com seu pai. Olhar ela lhe traz lembranças de sua infância..."
            + " De quando você ainda estava aprendendo a segurar seu escudo.",
        )
        cogumelosVerdes = Item("cogumelo verde", "Cogumelo com capacidades curativas")

        # Adicionando itens as salas
        cabana.addItem(roupas)
        cabana.addItem(machado)
        cabana.addItem(escudo)

        cozinha.addItem(simboloDeCaçada)
        cozinha.addItem(bilhete)

        dispensa.addItem(frutas)

        arredoresDeSiegheim2.addItem(cogumelosVerdes)

        # Atribuindo a sala inicial
        self.actualRoom = salaMisteriosa
Exemplo n.º 42
0
    def load(self, filename):
        start_room = None
        first_room = None
        new_room = None
        new_command = None
        cur_room_name = None

        file_stream = file(filename)

        for line in file_stream:
            line = string.translate(string.strip(line), \
                                    string.maketrans('\\', '\n'))

            if line.find("=") != -1:
                keyword, params = line.split("=", 1)
            else:
                keyword = line
                params = None

            if keyword == "TITLE":
                self.title = params[:]

            elif keyword == "START_ROOM":
                start_room = params[:]

            elif keyword == "INVENTORY_LIMIT":
                self.player.item_limit = string.atoi(params)

            elif keyword == "ROOM":
                new_room = Room()
                new_room.name = params[:]
                self.rooms[new_room.name] = new_room
                if first_room == None:
                    first_room = new_room

                cur_room_name = new_room.name

                new_command = None

            elif keyword == "LOCAL":
                cur_room_name = params[:]

                new_room = None
                new_command = None

            elif keyword == "GLOBAL":
                cur_room_name = None

                new_room = None
                new_command = None

            elif keyword == "COMMAND":
                new_command = Command()
                self.commands.append(new_command)

                if cur_room_name != None:
                    new_command.location = cur_room_name[:]

                if params[0] == "+":
                    new_command.condition = params[1:]
                elif params[0] == "-":
                    new_command.condition = params[:]
                else:
                    pos = params.find(":")
                    if pos != -1:
                        if params[pos + 1] == "+":
                            new_command.condition = params[pos + 2:]
                        else:
                            new_command.condition = params[pos + 1:]

                        new_command.commands = params[:pos].split(",")
                    else:
                        new_command.commands = params.split(",")

            elif keyword == "ACTION":
                # If there is no current command, make one.
                if new_command == None:
                    new_command = Command()
                    self.commands.append(new_command)

                    if cur_room_name != None:
                        new_command.location = cur_room_name[:]

                for action in params.split(";"):
                    new_command.add_action(action)
                    #new_command.actions.append(action)

            elif keyword == "DESC":
                if new_room != None:
                    new_room.desc = params[:]

            elif keyword == "ALT_DESC":
                if new_room != None:
                   new_room.desc_alt = params[:]

            elif keyword == "DESC_CONTROL":
                if new_room != None:
                   new_room.desc_ctrl = params[:]

            elif keyword == "CONTENTS":
                if new_room != None:
                   new_room.items = params.split(",")

            elif keyword == "NORTH":
                if new_room != None:
                   new_room.init_neighbor("N", params[:])

            elif keyword == "SOUTH":
                if new_room != None:
                   new_room.init_neighbor("S", params[:])

            elif keyword == "EAST":
                if new_room != None:
                   new_room.init_neighbor("E", params[:])

            elif keyword == "WEST":
                if new_room != None:
                   new_room.init_neighbor("W", params[:])

            elif keyword == "UP":
                if new_room != None:
                   new_room.init_neighbor("U", params[:])

            elif keyword == "DOWN":
                if new_room != None:
                   new_room.init_neighbor("D", params[:])

        if self.rooms.has_key(start_room):
            self.player.current_room = self.rooms[start_room]
        elif first_room != None:
            self.player.current_room = first_room
        else:
            self.player.current_room = Room()
            self.player.current_room.name = "limbo"
            self.player.current_room.desc = \
                "This adventure has no rooms.  You are in limbo!"

        file_stream.close()
Exemplo n.º 43
0
class Analysis:
    def __init__(self,cam_resolution, camera_number,  horizontal_sect,  vertical_sect, white_level,  person_ammount, new_person_tresh, sleep_period_value):
        print " analysis"
        #podzial sceny na sektory
        self.note_file_url = "results/results"
        self.cam_resolution = cam_resolution
        self.camera_number = camera_number
        self.white_level = white_level
        self.person_ammount = person_ammount
        self.sectors = []
        self.sleep_period_value =sleep_period_value
        row =[]
        self.persons =[]
        miny_x = range(0, cam_resolution[0], cam_resolution[0]/horizontal_sect)
        maksy_x = range(cam_resolution[0]/horizontal_sect,  (cam_resolution[0]/horizontal_sect*(horizontal_sect+1)),  cam_resolution[0]/horizontal_sect)
        miny_y = range(0,cam_resolution[1] , cam_resolution[1] /vertical_sect)
        maksy_y = range(cam_resolution[1]/vertical_sect,  (cam_resolution[1]/vertical_sect*(vertical_sect+1)),  cam_resolution[1]/vertical_sect )
        for i in range(vertical_sect):
            miny,  maksy= miny_y[i], maksy_y[i]
            for column in range(horizontal_sect):
                minx,  maksx = miny_x[column],  maksy_x[column]
                row.append((minx, miny, maksx,  maksy))
            self.sectors.append(row)
        self.room = Room(person_ammount, new_person_tresh)
        f= open(self.note_file_url, "w")
        f.close()
    def stop(self):    
        self.run_the_analysis =False
        
    def run_analysis(self):
        self.run_the_analysis= True
        print "run analysis"
        while self.run_the_analysis:
            images_data_file = open("images_data")
            face_number=0
            face_data =[]
            #wyszukuje linii definiujacych osobe
            for line in images_data_file:
                if(line.find("face")!=-1):
                    try:
                        face_number = eval(line[4:5].strip())   # zamienic na TRY bo sie czasem pierdoli
                        f_rect = eval(line.split(":")[1].strip())
                        face_data.append(face_number)
                        face_data.append(f_rect)
                    except:
                        break
                if(line.find("NOSE:")!=-1):
                    try:
                        nose_rect = eval(line.split(":")[1].strip())
                        face_data.append(nose_rect)
                    except:
                        break
                if(line.find("POINTS:")!=-1): 
                    try:
                        points_rect = eval(line.split(":")[1].strip())
                        face_data.append(points_rect)
                    except:
                        break
                    new_person = Person(face_data,  self.sectors,   self.white_level, self.note_file_url)
                    face_data =[]
                    #jak nadaje sie do analizy to tworze nowa osobe
                    if new_person.is_person_created():
                        print "twarz ",  face_number,  " nadaje sie do analizy"
                        person_class = self.is_a_new_person(new_person)
                        if person_class[0]:
                            print "to byla nowa osoba, dodalem ja"
                        else:
                            print "juz widzialem ta osobe, to byla osoba", person_class[1]," updatuje ja"
                            self.room.people_list[person_class[1]]=new_person
                    else:
                        print "osoba nie stworzona"
            images_data_file.close()
            time.sleep(self.sleep_period_value)
                
    def is_a_new_person(self, person):
        return self.room.check_and_add_if_new(person)
        #return False
        
    def extract_face_information(self):
        return [0, 0, 3, 2, 0]
    
    def detect_faces_with_threshold(self, original,  face_certanity):
        detected = cv.HaarDetectObjects(original,  self.haar_face, self.storage)
        #wybieram tylko te pewne twarze
        certain_faces= []
        for cvmatrix in detected:
            if cvmatrix[1]> face_certanity: certain_faces.append(cvmatrix)
        return certain_faces
Exemplo n.º 44
0
from nose.tools import *
import ex47.game import Room

def test_room():
	gold = Room("GoldRoom",
				"""This room has gold init you can grab. There's a 
				door to the north.""")
	assert_equal(gold.name, "GoldRoom")
	assert_equal(gold.paths, {})

def test_room_paths():
	center = Room("Center", "Test room in the center.")
	north = Room("North", "Test room in the north.")
	south = Room("South", "Test room in the south.")

	center.add_paths({'north': north, 'south': south})
	assert_equal(center.go('north'), north)
	assert_equal(center.go('south'), south)

def test_map():
	start = Room("Start", "You can go west and down a hole.")
    west = Room("Trees", "There are trees here, you can go east.")
    down = Room("Dungeon", "It's dark down here, you can go up.")

    start.add_paths({'west': west, 'down': down})
    west.add_paths({'east': start})
    down.add_paths({'up': start})

    assert_equal(start.go('west'), west)
    assert_equal(start.go('west').go('east'), start)
    assert_equal(start.go('down').go('up'), start)
Exemplo n.º 45
0
def test_map():
	start = Room("Start", "You can go west and down a hole.")
	west = Room("Trees", "There are trees here, you can go east.")
	down = Room("Dungeon", "It's dark down here, you can go up.")

	start.add_paths({'west': west, 'down': down})
	west.add_paths({'east': start})
	down.add_paths({'up': start})

	assert_equal(start.go('west'), west)
	assert_equal(start.go('west').go('east'), start)
	assert_equal(start.go('down').go('up'), start)
Exemplo n.º 46
0
def test_map():
    start = Room("Start", "You can go west and down a hole.")
    west = Room("Trees", "There are trees here, you can go east.")
    down = Room("Dungeon", "It's dark down here, you can go up.")

    start.add_paths({'west': west, 'down': down})
    west.add_paths({'east': start})
    down.add_paths({'up': start})

    assert_equal(start.go('west'), west)
    assert_equal(start.go('west').go('east'), start)
    assert_equal(start.go('down').go('up'), start)


# def setup():
#     print "SETUP!"
#     
# def teardown():
#     print "TEAR DOWN!"
#     
# def test_basic():
#     print "I RAN!"