示例#1
0
 def get_input(self):
     # Get each line of letters
     for x in range(self.rowLength):
         letters = raw_input()
         # Use each letter in the line to create a cell.  Create the cell list.
         for letter in letters:
             self.boxes[letter] = "test"
             cell = Cell(letter, 0, None, self.rowLength)
             self.cells.append(cell)
     # Get Letter to Result/Operation mappings.  Create boxes.
     for x in range(len(self.boxes)):
         lineSections = raw_input().split(':')
         character = lineSections[0]
         numberAndOperation = lineSections[1]
         operation = numberAndOperation[len(numberAndOperation) - 1]
         number = numberAndOperation[:-1]
         box = Box(number, operation)
         self.boxes[character] = box
     # Assign boxes to cells
     for cell in self.cells:
         box = self.boxes[cell.letter]
         cell.box = box
         box.cells.append(cell)
     # Assign rows and columns to cells
     for cellIndex in range(len(self.cells)):
         self.cells[cellIndex].row = self.rows[cellIndex / self.rowLength]
         self.cells[cellIndex].column = self.columns[cellIndex % self.rowLength]