Zippy is an algorithm game in which you need to navigate Zippy through the map, while avoiding all dangers and collecting all coins. This can be relatively easy using basic manoeuvres, however, finding the neatest solution can be tricky.
You start all maps with 100 points, and your goal is to provide a solution — gathering all coins — using the fewest bytes. To achieve this, you can write functions, use parameters, or even use recursion.
Find the best solutions and win great prices from LogMeIn!
(Zippy chiptune: Eric Skiff — Jumpshot • Available at http://EricSkiff.com/music)
While coding with Zippy, you can have any number of procedure lines, and 1 single action line.
Procedures might have any number of parameters. Parameters have 2 types: action parameters and numeric parameters.
Zippy has 4 basic actions, with which you can easily navigate him around the map.
Let's say we have the following code:
a(T):fa(T-1)
b(B):BrB
a(2)b(ff)
There are 2 procedure lines and 1 action line. Procedure 'a' has a numeric parameter 'T', and its only action is to write out a forward moving action, then call itself with a decremented value. This means that if you initially call 'a' with a parameter value of '2', it will write out 'f', then call itself again with a parameter value of '1', thus write out 'f' one again, but then the next invocation will be done with a parameter of '0', which will not be executed. Therefore this would mean moving forward 2 times.
The second procedure holds an action parameter, 'B'. The fact that this is an action parameter can be seen by the fact that 'B' is written 2 times in the action list of 'b', so it has to hold some actions. This time the action will be moving forward 2 times ('ff'), then turning to the right, then repeating the movement ahead 2 times ('ff').
The action line simply calls the above defined 2 procedures with the parameters '2' and 'ff'. So the output of the code above will be: moving forwards 2 times, then moving forward 2 times again, turning to the right and finally, moving 2 times again.