本文整理汇总了Python中game.Room.add_paths方法的典型用法代码示例。如果您正苦于以下问题:Python Room.add_paths方法的具体用法?Python Room.add_paths怎么用?Python Room.add_paths使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类game.Room
的用法示例。
在下文中一共展示了Room.add_paths方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_room_paths
# 需要导入模块: from game import Room [as 别名]
# 或者: from game.Room import add_paths [as 别名]
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)
示例2: test_map
# 需要导入模块: from game import Room [as 别名]
# 或者: from game.Room import add_paths [as 别名]
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)
示例3: test_map
# 需要导入模块: from game import Room [as 别名]
# 或者: from game.Room import add_paths [as 别名]
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)
示例4: Room
# 需要导入模块: from game import Room [as 别名]
# 或者: from game.Room import add_paths [as 别名]
a football comes crashing through your window. Before you can even react, the
device emits a series of quick beeps, that get closer together before violently
releasing a deathly black gas that instantaneously knocks you out cold.""",
"Press Enter to Continue...")
hallway = Room("in your apartment hallway.",
"""\"You've made the right choice\" The stranger lady says. \"The name's Leandra
Serafim, but we have to get you out of here quick.\" She makes a dash for the
nearest exit. You try to follow, but the closer you get to the outside world, the
more anxious you feel and the harder it is to breathe. Fear creeps up on you and
chokes you from the inside. Eventually you fall to the ground as everything goes
black...""", "Press Enter to Continue...")
defilers_base = Room("in a dark room.", """You are at the defilers base. Gotta figure out what to do now.""",
"Press ctrl-d to Quit.")
rebel_base = Room("at the rebel base.", """You are in the rebel base. Gotta figure out what to do now.""",
"Press ctrl-d to Quit.")
intro.add_paths({'': character})
character.add_paths({'':apartment})
apartment.add_paths({'yes': stocks, 'no': skip_stocks})
skip_stocks.add_paths({'': email})
stocks.add_paths({'': email})
email.add_paths({'north': foyer})
foyer.add_paths({'yes': granted, 'no': denied})
granted.add_paths({'':choices})
denied.add_paths({'':choices})
choices.add_paths({'stay': apartment2, 'go': hallway})
apartment2.add_paths({'':defilers_base})
hallway.add_paths({'': rebel_base})