A large, alligator like creature has recently escaped from a bioengineering lab and is believed to be hiding inside local lakes and ponds. The creature's alligator DNA was crossed with those of a prehistoric crocodile, a great white shark, a komodo dragon and, it is rumored, the DNA of a former cs prof who was driven insane by his students. This mixture makes it EXTREMELY dangerous. People walking along the water's edge stand a one in ten chance of being attacked.
You are to download the
file alligator.java and use that in place
of "pathfinder.java". Also download "gator.gif":
Modify your program to avoid being eaten by the mutant alligator.
Note this carefully: You can only be attacked at the water's edge. That is, when you are on land and at least one of the four neighboring coordinates is water. Once you're on the water inside a boat, you'll be safe. It's only the water's edge that's dangerous.
Don't simply avoid the water's edge. Because that may make it impossible to get to the diamond. Instead, the cost of getting close to water should be very high. You'll want the diamond so bad that sometimes it's worth the risk!
You should be aware that the variable *gatorchance* inside class alligator controls the chance of being attacked when you're near water.
When you change the graphics code in alligator.java (to account for different
terrain), you need to be aware that this program (in contrast to the simpler
pathfinder.java) uses a "triple buffering" technique for animation. There
are three buffers. Only one of these is actually visible. There are two
other buffers (of type *Image*): clip and dbuf. Corresponding to each
buffer is a *Graphics* device for drawing to the buffer:
This assignment should only be done after you have satisfied the minimal requirements. You need to implement The A* algorithm in full.