CodeGolf4k

I “finished” the game and submitted it to Java4k. Play it here:

http://www.java4k.com/index.php?action=games&method=view&gid=466

Original post:

A few days ago I decided it would be fun to make a game similar to Robozzle and this is what I’ve come up with so far:

CodeGolf4k

The aim is to get the “ball” in the hole while using as little of the program blocks as possible (hence “Code Golf”).

Update: if there are bars on top of the hole then the gray buttons must be pressed first. Some levels start with the ball on the hole but the buttons unpressed.

Instructions (hopefully they make sense):

The four commands are:
^ : move forward one step
< : turn left

: turn right
R : return to the last branch point (see below)

You can create a branch by clicking on the top or bottom of a program block and dragging to the top or bottom of another block.
Branches will cause the program to jump to the block it points to instead of advancing normally. Also, the return command will make the program continue from where it last branched (branching and returning works basically the same as calling a function and returning works, call stack included).

Selecting a colour in the palette and colouring a block will cause the command in the block to only get executed if the ball is on that colour (White means any colour).

Colouring a branch will cause it to only branch if the ball is on that colour. If a block has a white branch and a coloured branch pointing to different places it will prefer the coloured one if the ball is on that colour.

selecting the blank command at the bottom will allow you to recolour blocks without changing their command.

You can right-click on blocks to clear their command or on the start point of a branch to remove it.

Let me know what you think, suggestions are very welcome.

Hope you like it!

Error: “g.class” not found… :S

Bad timing :(, I only just updated it and it might take a little while for GitHub to start hosting the new jar file.

Edit: It should work now

I’ve updated the game, it now has four levels and the last two levels have buttons which have to be pressed before the ball can go down the hole.

It also shows a par, which is the number of blocks I solved it with.

Hint for the last level (Edit: now the second to last level):
[spoiler]
It’s a tree, use recursion.
[/spoiler]

Updated again, It now has 10 levels and is at 4063 bytes

I suggest you to change a bit the “turn left” and “turn right” icons, so no one would confuse them with the “move forward” one. Instead of “<” and “>”, what about drawing them this way : “<-1” and “1->”.

In your game instructions, you may also add an indicative score rating, so each player would know her/his worth.

Ok, I’ve changed that and a few other minor things (you might need to clear your java cache for it to change). Thanks for the suggestion, I thought of changing those icons a little while ago but then forgot about it.

Yeah, I wrote up these instructions pretty quickly and when I rewrite them I’ll probably do something like that, as well as hints because some of the higher levels are quite difficult.