|
Safe Harbor is an app I wrote years ago in C for Palm and PocketPC
based on the plastic puzzle "Stormy Seas" by Binary Arts. It's small
enough that experiments can be concluded quickly. One such experiment
is porting to Java. This applet consists of only one file of
AWT-aware Java. Nearly all of the code should work readily with
other UI toolkits.
How to play? Move the pointy red boat into the harbor at the
bottom. The blue wave bars slide side to side in order to line up
openings for the boats to move into. The red boat can be turned if
necessary by dragging its pointy end, but only if it's in a large
enough open space. None of the other boats (which appear in Game 5)
can turn, but they can move sideways.
Still to do:
- Key handling. The "cross platform" code does this, but I haven't
figure out how to get key events in AWT. Given key events you can
play with a five-way alone.
- State saving. Switch games and return and your undo stack
remains. Reload the page, however, and all's lost. This is an
AWT-specific thing. I'll worry about it when on a platform with
better persistence.
- Solving. The C code includes a brute-force puzzle solver. While
it's nearly instantaneous on a desktop, it needed resources the 68K
Palm never had and so I shipped with hard-coded solutions for every
puzzle. When I ported Safe Harbor to Lua (for Foleo) there were some
puzzles that couldn't be solved even on my desktop in an overnight
run. So the solve feature tests both language and computer. Once
I get it ported to Java we'll see how things look.
|