Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Agricultural Sudoku Programming, and the API to help
If you had to work on the Sudoku project, or if you have to now, know this: Make each cell have access to the row and column it is in, as well as the sudoku puzzlethese rows and columns are a part of. Also make sure that each row and column can access the sudoku puzzle that they are a part of. Assuring that your code provides these accessors will make your code much cleaner because you will not violate the law of demeter. I found myself going through each cell in a puzzle region, searching for row and column conflicts, by getting each cell from the puzzle region list, reaching in to the puzzle's row and column lists, and searching these lists for the cells in the region. That is far too much searching to do when you have to look for conflicts in every cell each time a number changes! Instead, sacrfice on the side of memory to get better speed.
Since smalltalk is on a VM, instantiating that many more object references doesn't increase the footprint of the Sudoku app by a whole lot. So upon instantiating each cell in the puzzle, make sure it has a reference to the row, column, and region it is in. Also make sure it has a reference to the puzzle object, just in case. This allows you to check for valid cell values with cleaner code that doesn't violate the law of demeter, and also to deconflict cells with greater speed.
When you do find yourself searching throughs OrderedCollections, know that Chapter 11 (Collections) of Smalltalk by Example is your best resource. In fact, I found it to be the best resource for Smalltalk coding in the entire class. For GUI development though, JOY provides more instructive lessons. The pdfs in your /doc directory also provide excellent snippets for accomplishing some of the nastier functions that are required by the class, such as BOSS serialization. Anything Professor Waters covered in class that seemed difficult to code, I found a walkthrough in the visualworks documentation almost mathced his lecture tutorial on the subject.
Link to this Page
- Cases last edited on 30 July 2011 at 2:33 am by r59h132.res.gatech.edu