Befunge Brain Teasers
7 solutions, 26 points
I'm typing this on my phone, because I don't have access to my computer currently. I actually had to work out Puzzle 6 by pen & paper.
Puzzle 1 (Score 3): 4f52d5b243
1v
v:< <
>.1+:56+-|
@
This one is fairly straight forward. Get a 1
on the stack, then print-increment-compare-loop until 11
is hit.
Puzzle 2 (Score 3): 85226eba20
"`" v
v"z":,:+1<
>- |
@
Basically the same as the previous one, just with characters instead of numbers. Used a different IP route though.
Puzzle 3 (Score 5): 1ff5bcb1d9
"!dlroW"v
>,,,, ,,v
, "
, ? ,
o
l
??,??? l
, e
? " @
??^,"H" <
? ?
???? ??
? ??
Here I cheaped out a little bit. Push the string to the stack and print characters manually, navigating through the spaces. I had loads of extra room, so I just left most of the question marks in. Note the trailing spaces on rows 6 to 8, I didn't remove them when calculating the hash.
Puzzle 4 (Score 2): f8b7bdf741
"{". @
Really simple, just get the character with the correct code and print as a number, with two free spaces.
Puzzle 5 (Score 5): c4db4b6af9
v
??"??
#,_@e">>:
<"B"<^
ung"<^"ef
This was a fun one to get right. May not work correctly on some interpreters due to wrapping strings & jumps, works on the linked one. Basically, the code pushes the output string and then enters the standard printing loop, wrapping on the sides.
Puzzle 6 (Score 5): 356e912eec
1 v
#
v??v_
5
75<^ p15:-1g15,:*
>5+:,"floG edoC dna selzzuP gnimmargorP ">:#,_@
@
Now this was the "masterpiece". I actually took a piece of paper and spent some time on this. (Actually, I did some extra work by missing the space in the string when copying.) Note the trailing spaces on row 4, I didn't remove them when calculating the hash.
The code works by first pushing a one to enter the main loop. The loop uses the #
on the second line as a counter, and both prints and pushes a #
on every iteration. After that a newline is printed and pushed. Next, the given string is pushed. Finally, the code enters a printing loop, which prints everything on the stack in reverse, which means the string, then the newline, and finally the remaining #
s.
Puzzle 7 (Score 3): 0881fc2619
"0"> :,1+v
|-":":<
@>"10",,
This is almost the same as Puzzle 2, but with a different route, different output characters, an additional 01
in the end and a quick wrap to finish it off.
4 solutions, 15 points
I hope I didn't mess up the trailing whitespace anywhere when generating the hashes.
Puzzle 1 (Score 3): de1de4c4c8
v
v< >
>1+:.:9`!|
@
Puzzle 3 (Score 5): 071cad0879
"!dlroW"v
>,,,, ,,v
, "
, ,
o
l
, l
, e
" @
^,"H" <
Puzzle 4 (Score 2): 531940bc43
"{". @
Puzzle 5 (Score 5): 5bafaed8e9
^
v >,,
n"<@,, ,"
"e"^>,
uge"<^"Bf