Beispiel #1
0
	def __init__( self, t):
		Puzzle.__init__(self)
		self._shape = t
		self._start_position = (0,0)
		self._finish_position = (t[0]-1, t[1]-1)
		self._grid = Grid( t)
		self._allowed_moves = MazePuzzle._DEFAULT_MOVES
Beispiel #2
0
 def __init__(self, t):
     Puzzle.__init__(self)
     self._shape = t
     self._start_position = (0, 0)
     self._finish_position = (t[0] - 1, t[1] - 1)
     self._grid = Grid(t)
     self._allowed_moves = MazePuzzle._DEFAULT_MOVES
    def __init__(self,
                 from_word: str,
                 to_word: str,
                 word_set: Optional[Set[str]] = None) -> None:
        """
        Create a new word-ladder puzzle with the aim of stepping
        from <from_word> to <to_word> using words in <word_set>, changing one
        character at each step.

        If <word_set> is None, the words are loaded using load_words.

        Precondition:
        len(from_word) == len(to_word)
        from_word and to_word are both in word_set
        all words in word_set are lowercase
        """
        Puzzle.__init__(self)
        if word_set is None:
            word_set = load_words()

        (self.from_word, self.to_word, self.word_set) = (from_word, to_word,
                                                         word_set)
        # set of characters to use for 1-character changes
        self._chars = LETTERS
 def __init__(self, filename):
     Puzzle.__init__(self, filename)
     self.ntries = 0