コード例 #1
0
 def get_start_index(self, line: CellsLine, instructions: List[int],
                     instruction_index: int):
     inverted_index = self.get_end_index(
         line=line.inverse(),
         instructions=instructions[::-1],
         instruction_index=self.inverse_index(
             index=instruction_index, list_length=len(instructions)))
     return self.inverse_index(inverted_index, len(line))
コード例 #2
0
 def solve(self, line: CellsLine, instructions: List[int]) -> CellsLine:
     line = self.solve_one_way(deepcopy(line), instructions)
     if not self.one_way:
         line = self.solve_one_way(line.inverse(),
                                   instructions[::-1]).inverse()
     return line