Esempio n. 1
0
 def willStepOnObject(self, pos):
     if lm.charAtPosition(pos) == 'A':
         self.hasNeedle = True
     elif lm.charAtPosition(pos) == 'E':
         self.hasEther = True
     elif lm.charAtPosition(pos) == 'T':
         self.hasTube = True
     elif lm.charAtPosition(pos) == 'X':
         if not self.hasAllObjects():
             self.alive = False
Esempio n. 2
0
 def goUp(self, laby):
     goingToPos = Position.Position(self.pos.line - 1, self.pos.column)
     self.willStepOnObject(goingToPos)
     if lm.charAtPosition(goingToPos) != "*" and self.pos.line > 0:
         lm.updatePersoPositionInLaby(self.pos, goingToPos)
         self.pos = goingToPos
     else:
         lm.showWarning()
Esempio n. 3
0
 def goRight(self, laby):
     goingToPos = Position.Position(self.pos.line, self.pos.column + 1)
     self.willStepOnObject(goingToPos)
     if lm.charAtPosition(goingToPos) != "*" and self.pos.column < len(
             laby[self.pos.line]) - 1:
         lm.updatePersoPositionInLaby(self.pos, goingToPos)
         self.pos = goingToPos
     else:
         lm.showWarning()