Ejemplo n.º 1
0
	def test_do_action(self):
		rooms.current_room = self.test_room
		self.assertEqual(engine.do_action("look direction","north"),self.test_door.desc,"Looking at a closed door should generate the door description.")
		self.assertEqual(engine.do_action("look direction","west"),self.second_test_room.short_desc,"Looking through an open door should generate the short description of the room on the other side.")		
		print engine.do_action("look direction","up")
		print output.look_direction_error
		self.assertEqual(engine.do_action("look directon","up"),output.look_direction_error,"Looking in a direction where there is no exit should generate an error message.")
Ejemplo n.º 2
0
def main():
	print "Welcome!"
	print rooms.current_room.show_full_desc()

	while True:
		rooms.previous_room = rooms.current_room
		user_input = raw_input("Enter a command: ").lower()
		action, arguments = engine.get_action(user_input)
		response = engine.do_action(action,arguments)
		print response
		if action == "quit":
			break
		print rooms.show_room()