Ejemplo n.º 1
0
    def move(self, amount, turn_letter):
        prev_direction = self.current_direction
        prev_x = self.curr_x
        prev_y = self.curr_y

        self.current_direction = Direction.get_new_direction(self.current_direction, turn_letter)

        if self.current_direction.index_value == Direction.NORTH:
            self.curr_y += amount
        elif self.current_direction.index_value == Direction.SOUTH:
            self.curr_y -= amount
        elif self.current_direction.index_value == Direction.EAST:
            self.curr_x += amount
        elif self.current_direction.index_value == Direction.WEST:
            self.curr_x -= amount
        else:
            raise "Oh boy..."

        print "[" + str(prev_direction) + "] + [" + str(amount) + str(turn_letter) + "] = " + str(self.current_direction)
        print "(" + str(prev_x) + "," + str(prev_y) + ") -> (" + str(actor.curr_x) + "," + str(actor.curr_y) + ")"
        print