Next / Previous / Contents / Shipman's homepage

24. Puzzle.__buildChoices(): Set up initial word choices

kkck
# - - -   b u i l d C h o i c e s

    def __buildChoices ( self ):
        '''Define the initial word choices for each slot.

          [ self.__cellMap and self.__slotMap are as invariants ->
              self.__wordBank  +:=  choices for slots in
                  self.__slotMap that are consistent with any
                  clues in self.__cellMap ]
        '''

See Section 25, “Puzzle.__buildSlotChoices(): Build the initial set of choices for one slot”.

kkck
        #-- 1 --
        # [ slotList  :=  slots in self, sorted ]
        slotList = self.__slotMap.values()
        slotList.sort()

        #-- 2 --
        for slot in self.__slotMap.values():
            #-- 2 body --
            # [ self.__wordBank  +:=  choices for slot that are
            #       consistent with any clues in self.__cellMap ]
            self.__buildSlotChoices ( slot )