comparison gamelib/missions.py @ 241:f5d9a063013b

Fail very long equipment lists automatically
author Neil Muller <drnlmuller@gmail.com>
date Sun, 13 May 2012 00:16:44 +0200
parents 3731b3ca3b48
children 594c45f0f685
comparison
equal deleted inserted replaced
240:af86a207d8d2 241:f5d9a063013b
142 142
143 def attempt(self, equipment, state): 143 def attempt(self, equipment, state):
144 # No equipment is usually a special case. 144 # No equipment is usually a special case.
145 if not equipment: 145 if not equipment:
146 return self.attempt_no_equipment(state) 146 return self.attempt_no_equipment(state)
147
148 # Fail overly complex plans automatically
149 if len(equipment) > 10:
150 self.fail(
151 "Your plan is much too complicated, doctor. Surely there"
152 " is a more elegant solution?")
147 153
148 # Try with some equipment. 154 # Try with some equipment.
149 self.attempt_with(self.categorise_equipment(equipment), state) 155 self.attempt_with(self.categorise_equipment(equipment), state)
150 156
151 # No result, so generic failure. 157 # No result, so generic failure.