You guide the sailboat around the island using your mouse. If you hit the island or the rocks your health goes down by 1. If you catch a treasure, your treasure points go up by 1, and health goes up by 1. If your health points go below 5 you are shipwrecked. You can blast away rocks by pressing the space keys.
Initial idea is from a coding book by Max Wainwright.