Exemple #1
0
	def test_show_room(self):
		rooms.current_room = self.test_room
		self.assertNotEqual(rooms.previous_room,rooms.current_room,"Previous room and current room should be unequal before assignment")
		self.assertEqual(rooms.show_room(),self.test_room.show_full_desc(),"Should show full description of room while current room and previous room are unequal.")
		rooms.previous_room = rooms.current_room
		self.assertTrue(rooms.current_room == rooms.previous_room,"Current room and previous room should be equal after reassignment.")
		self.assertEqual(rooms.show_room(),self.test_room.show_room_name(),"Should show only the room name while current room and previous room are equal.")
Exemple #2
0
def main():
	print engine.game_intro()
	while True:
		response, action = engine.game_cycle(engine.get_input)
		print response
		if action == "quit":
			break
		print rooms.show_room()
Exemple #3
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()