Beispiel #1
0
    def _add_word(word: str, puzzle: Puzzle, location: Tuple[int, int],
                  orientation: Orientation, inverted: bool) -> Puzzle:
        change_vector = orientation.get_vector()
        if inverted:
            change_vector = -change_vector[0], -change_vector[1]

        new_puzzle = puzzle.__copy__()

        for i in range(len(word)):
            current_location = (location[0] + i * change_vector[0],
                                location[1] + i * change_vector[1])
            puzzle.set(word[i], current_location[0], current_location[1])

        return new_puzzle