GridOS 1 quest 1, 1 head

I tried to write 1 head versions of all programs.

The head travels right. If it encounters an A, delete. If it encounters an B, replace. If it encounters a C, write 3 P’s by going in a little loop. The loop goes either up or down, alternating. That felt very nice and elegant.

Part 2 is very similar, the loop might just be bigger.

Because there might be 2 lines in part 3, instead of a loop, I just go straight up or down. The 1st line produces 0-5 P’s, the 2nd line produces 0-7 P’s. I use E and F to keep track of my state. E means the 1st line produced 0 P’s.

All my code .

Skriv en kommentar