[Community Puzzle] ASCII Art with Logo Language, Part 2

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @Eulero314,validated by @Dr_Meyss,@McKael and @FredericLocquet.
If you have any issues, feel free to ping them.

Some notes:

  • “The index for cycling characters resets each time you use SETPC.”
    This is not actually tested.
  • " ; [ ] can’t be used in pen."
    Only “;” is (indirectly?) tested. For example you don’t have a test like RP 2 [setpc Hello] that would check if the program correctly parses the last “]”.
  • “REPEAT command can be nested.”
    Technically true but with that wording one would expect stuff like RP 2 [RP 2 [cmds] ; RP 2 [cmds]] to be possible. Instead, inside the [] you can only find a single RP command or a batch of non RP commands. Knowing this allows for le cheese as you can see in my solution. If this was intended, I think it should probably be stated somewhere.
  • (Very minor) The constraints for N and loop are way higher than what they actually are.

In general I feel a bit let down by the tests. The puzzle is great fun but I wished there were more of them, especially for the loop part. I know it’s a lot of work so please take my opinion with a grain of salt.

At any rate, I hope you can also do a third part, it was really nice.

test added!

I added this test also RP 2 [RP 2 [fd 5 rt 90 setpc +] ; RP 2 [fd 5 rt 90 setpc *]]
Let me know if I get your point please

I added another test, please see if consistent. If you have a test to suggest, go ahead. I have a problem with the output length, so I ran out of imagination :frowning:

part 3 is out, please comment

1 Like

There seem to be some issues with the new cases not consistent with the specification. I’ll leave a comment in the contribution view.

Fixed, thanks!

2 Likes

Glad to see new tests added to it. Surprisingly my solution still passes everything, I guess I underestimated (and probably not fully understood) my loop parsing logic.

But it wasn’t in vain, I’ve tested the 5 solutions currently shared in python and only 2 (including mine) do pass all tests. Funnily enough a couple of them bug at the Hello test, so it wasn’t a small detail after all.

Yet if you really wanted to break my code that wouldn’t be hard. Since I parse the loops by matching “[” and “]” line by line, you would just need to add a loop that spans through multiple lines. Something like:

2
RP 8 [fd 1;
rt 45]

In that case, as far as I can see, only CarlWalsh solution would pass the test.

The statement in Part 2 isn’t clear on the point that loop instructions can span through multiple lines, and it’s better not to update the puzzle any more… So I guess the test case you have suggested can appear in Part 3 instead. It’s also better to include the specification in the statement in Part 3. You may leave a comment there! :wink:

ok, I’ll add to part 3

I like the new test cases. My error was so simple. None of the original test cases ever had a ‘;’ directly after exiting a loop with more commands afterward.

I write comment on the Part1. But I see you fix the description on the setpc, but you command about the ; [ ] that can not be used, maybe need to be add to the CS. And the other thing is SETPC can I use the space in the input if I write a thing like that SETPC Hello My Friend; In the end my parser read the first space and after read until the end of the instruction. But you maybe need doing a better definition of this stuff. Anyway after doing the part 1, I have done this part in less of 30 minutes maybe. That go really fast, if you do the part 1 before.

1 Like