本文整理汇总了Python中room.Room.adjacent_north方法的典型用法代码示例。如果您正苦于以下问题:Python Room.adjacent_north方法的具体用法?Python Room.adjacent_north怎么用?Python Room.adjacent_north使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类room.Room
的用法示例。
在下文中一共展示了Room.adjacent_north方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: rooms_setup
# 需要导入模块: from room import Room [as 别名]
# 或者: from room.Room import adjacent_north [as 别名]
def rooms_setup():
"""Create the rooms (and their contents) in the Dungeon of Doom! Return the current room."""
key = Key(description='a shiny, gold key')
dagger = Dagger(description='a dagger, made of steel')
spider = Spider(description='an extremely large, very hairy, very angry spider')
treasure = Treasure(description='a large chest filled with treasure beyond your wildest imagination')
ring = Ring(description='a ring with a blue sapphire that makes you invisible')
# print(repr(key))
# print(repr(dagger))
# print(repr(spider))
# print(repr(treasure))
# create rooms (12 means row 1, column 2; 21 means row 2, column 1; and, so on...)
# doors are set to open if the player would have had to pass through it from the other side
room_12 = Room(contents=treasure, door_north=None, door_south='open', door_east=None, door_west=None,
description='You are in a circular room with gold leaf walls and a marble floor.',
adjacent_north=None, adjacent_south=None, adjacent_east=None, adjacent_west=None)
room_21 = Room(contents=key, door_north=None, door_south=None, door_east='open', door_west=None,
description='You are in a small, non-descript room.\nThe only door is the one in through which you came.',
adjacent_north=None, adjacent_south=None, adjacent_east=None, adjacent_west=None)
room_22 = Room(contents=spider, door_north='locked', door_south='open', door_east=None, door_west='closed',
description='You are in a large room with high ceilings.\nThere are doors to the North, West, and South.',
adjacent_north=None, adjacent_south=None, adjacent_east=None, adjacent_west=None)
room_31 = Room(contents=ring, door_north=None, door_south=None, door_east='open', door_west=None,
description='You are in an ornate bedroom.\nThe only door is the one in through which you came.',
adjacent_north=None, adjacent_south=None, adjacent_east=None, adjacent_west=None)
room_32 = Room(contents=None, door_north='closed', door_south=None, door_east='closed', door_west='closed',
description='You are in a small, dank room with no windows and low ceilings.\nYou see doors to the West, North, and East.',
adjacent_north=None, adjacent_south=None, adjacent_east=None, adjacent_west=None)
room_33 = Room(contents=dagger, door_north=None, door_south=None, door_east=None, door_west='open',
description='You are in a musty closet.\nThe only door is the one in through which you came.',
adjacent_north=None, adjacent_south=None, adjacent_east=None, adjacent_west=None)
#print(repr(room_32))
# link rooms to each other (after initialization because we need refs to each room)
room_12.adjacent_south = room_22
room_21.adjacent_south = room_31
room_21.adjacent_east = room_22
room_22.adjacent_north = room_12
room_22.adjacent_south = room_32
room_22.adjacent_west = room_21
room_31.adjacent_north = room_21
room_31.adjacent_east = room_32
room_32.adjacent_north = room_22
room_32.adjacent_east = room_33
room_32.adjacent_west = room_31
room_33.adjacent_west = room_32
#print(repr(room_32))
return room_32