For the Sudoku model we use the ML-Sudoku package developed by Martin Laubach which is available on SqueakSource. We thank him for allowing us to use this material. To load the package, open a Monticello browser and click on the +Repository button. Select HTTP as the type of repository and specify it as follows:
Click on the Open button, select the most recent version and click Load.
ML-Sudoku is composed of 4 classes:
MLPossibilitySet. The class responsibilities are distributed as follows:
MLSudokuis the Sudoku solver. It knows how to solve a Sudoku.
MLCellknows its neighbors and their location on the game board. A cell does not know its possibility set, see
MLBoardcontains the cells and their possibility sets.
MLPossibilitySetis a list of possible numbers between 1 and 9 that can go into a cell. These are the values that are possible without violating the Sudoku rule that each row, column and 3-by-3 sub-grid contains each number once.