Talk:G arD^EN CorUtY@rD
Interpreter
The BCT aspect of this sucked me in and I couldn't resist trying out an ANSI art style interpreter: https://gist.github.com/hornc/7860821f7642e58c9bf217d663ea655e I don't know how well it'll work under Windows or Mac with line endings and ANSI, but it works under Linux. I'd like it to be portable, so if anyone has any pointers let me know. There's an image to show the final output. The `@` character runs around the courtyard as the program progresses. I'm not sure if I've made a mistake interpreting the spec, or the example orders the characters incorrectly, but I output the 'i' before the 'H'. The command queue confused me a little, I wasn't sure why the commands couldn't be actioned immediately, but it seems to work out either way. Consider this a start interpreter, it's very quickly thrown together, Input and wrapping/restart aren't even attempted. Enjoy! Salpynx (talk) 01:27, 3 August 2022 (UTC)
- Update: I figured out why the output was reversed, I mis-interpreted
K
as ignorable padding. It actually ends the initial datastring. Fixed now and outputs 'Hi' as expected. Salpynx (talk) 02:44, 4 August 2022 (UTC)
Thank you! I really didn't know how to implement this myself (I haven't messed around with implementing 2d languages much). I really like the syntax highlighting; it looks really cool. BoundedBeans (talk) 02:13, 5 August 2022 (UTC)
Why the "Hi" program goes against the specification
My specification for this language states: The rectangle must only contain valid commands, even if they are never reached. This is to encourage programs to look like a nice garden, although this can of course be circumvented by filling all unnecessary parts with ground bricks.
This was supposed to include whitespace. My original intent was for programs to be required to be a perfect rectangle until a newline following a line containing an underscore. Unfortunately, when I wrote the "Hi" example program, I accidentally forgot to include one character in the final line (looking at the rest of the program, it should have been an x
). Salpynx's interpreter doesn't actually check if programs are a perfect rectangle, meaning that, by a tiny technicality, it is not fully compliant. This is fine though; because programs without this restriction form a strict superset of the programs that do, the absence of checks could be viewed as an extension to the language. BoundedBeans (talk) 00:45, 13 November 2023 (UTC)
- I've added the missing character to the program just now. BoundedBeans (talk) 23:24, 12 May 2024 (UTC)