当前位置: 首页>>代码示例>>Python>>正文


Python Room.go方法代码示例

本文整理汇总了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))
开发者ID:16CPFA-Kim-Jiyun,项目名称:16CPFA-Kimjiyun,代码行数:11,代码来源:ex47.py

示例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)
开发者ID:16PFCYoonKim,项目名称:CPFC_KY,代码行数:14,代码来源:ex47.py

示例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)
开发者ID:robertreichner,项目名称:lpthw,代码行数:14,代码来源:ex47_tests.py

示例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)
开发者ID:robertreichner,项目名称:lpthw,代码行数:10,代码来源:ex47_tests.py


注:本文中的game.Room.go方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。