本文整理汇总了Python中game.Room.go方法的典型用法代码示例。如果您正苦于以下问题:Python Room.go方法的具体用法?Python Room.go怎么用?Python Room.go使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类game.Room
的用法示例。
在下文中一共展示了Room.go方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_room_paths
# 需要导入模块: from game import Room [as 别名]
# 或者: from game.Room import go [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 go [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 go [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: test_room_paths
# 需要导入模块: from game import Room [as 别名]
# 或者: from game.Room import go [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)