Projects
I develop quite a lot, this growing list is an attempt to contain a sampling of the things I've written. They range from small scripts in various programming languages to Widgets and programs. The dates reflect when the item was last updated. For older projects, the date may be when it was first publically posted. Click the icon images to see a larger preview of the project. Some projects may not have larger previews.
Written after a class I took where one of the assignments was to write a program to optimally solve any given 3x3 blackout board. Given that, it should be noted that any random board can be solved in 9 moves or less. Thus clicking the same square twice is technically counter productive, even if moves have been made since.
To play: Each chip has two colors, red and blue which they flip between. Clicking on a chip flips its color and those to the top, right, bottom, and left of it. To win, all chips must have the same color facing up.
Roughly based on A Beautiful Mind :: Blackout, which was our reference game to understand how blackout worked (if we didn't already).
A not-quite-so-simple example of how to do layered drawing in Swing. I've seen a lot of Swing programmers try to tackle making some sort of display where a user can draw arbitrary shapes on to a panel.
The typical (and intuitive?) approach is to use only one panel, and draw everything on it. This works if a new shape is not drawn on the panel until after the mouse is released. If the new shape is continually updated to show the user how it now looks, all shapes previously drawn to the panel must be redrawn (due to how Swing repaints work). This doesn't scale if many shapes have been drawn to the panel, or if the previous shapes are complex.
A better solution, shown via this example Java program, is to have two panels stacked by z-index. The panel on bottom just concerns itself with drawing all previous shapes. The top panel is only for drawing the new shape, so it can continually be updated without having to redraw anything else. When the user finishes drawing it, it is then added to the list of shapes the bottom panel handles. This approach works much better even with many or complex shapes, as the bottom panel has to be redrawn less often.
A small example class, written in Java, to demonstrate how to construct a panel showing an image larger than the panel's view area while allowing the user to drag it around to bring other parts of the image into view.