Beispiel #1
0
 def goUp(self):
     goingToPos = Position.Position(self.pos.line - 1, self.pos.column)
     self.willStepOnObject(goingToPos)
     if self.lmanager.charAtPosition(
             goingToPos) != "*" and self.pos.line > 0:
         self.lmanager.updatePersoPositionInLaby(self.pos, goingToPos)
         self.pos = goingToPos
     else:
         pass
Beispiel #2
0
 def buildAvailPositionList(self):
     positionList = []
     for line in self.laby:
         for x in range(0, len(line)):
             if line[x] == " ":
                 indexOfCurrentLine = self.laby.index(line)
                 positionList.append(
                     Position.Position(indexOfCurrentLine, x))
     return positionList
Beispiel #3
0
 def goRight(self):
     goingToPos = Position.Position(self.pos.line, self.pos.column + 1)
     self.willStepOnObject(goingToPos)
     if self.lmanager.charAtPosition(
             goingToPos) != "*" and self.pos.column < len(
                 self.lmanager.laby[self.pos.line]) - 1:
         self.lmanager.updatePersoPositionInLaby(self.pos, goingToPos)
         self.pos = goingToPos
     else:
         pass
Beispiel #4
0
 def nbInGameObjets(self):
     gameObjetList = []
     for line in self.laby:
         for i in range(0, len(line)):
             if line[i] != "*" and line[i] != "X" and line[
                     i] != " " and line[i] != "8":
                 indexOfCurrentLine = self.laby.index(line)
                 gameObjetList.append(
                     Position.Position(indexOfCurrentLine, i))
     return str(3 - len(gameObjetList))
Beispiel #5
0
 def findInitPosition(self):
     for line in self.laby:
         for x in line:
             if x == '8':
                 return Position.Position(self.laby.index(line),
                                          line.index(x))