by mellonaut · 2y ago · 0 comments
A guy (called Piet!) saw an artwork that reminded him of Piet (the lang) and tried executing it¹.
> It ran! [...] This is probably the first time in history that a graphic artist has painted a functionally workable computer program by accident.
[0]: https://www.dangermouse.net/esoteric/piet/samples.html [1]: https://gitlab.fabcity.hamburg/hofalab/piet-get-together
- for Perl, OCR to a character set
- for Piet, manual “convert[ion] into a clean image file using close colours from the Piet palette”
I don't actually have much idea of how far, numerically, colors vary due to different illumination, or due to different digitization processes.
> It ran! The code executes an infinite loop which reads in ASCII characters and prints out the corresponding numerical ASCII values.
Get out of town. Get right out of town.
> Naturally, a more accurate value can be obtained by using a bigger program.
I think that's a first for me.
Edit: Oh yes, it's "westley" from 1988: https://www.ioccc.org/years-spoiler.html#1988_westley
EDIT: Ah, nvm. It's truncating the result to 2 decimal places.
If I remember correctly, this program also calculates pi more precisely the larger the circle.
> Unless otherwise indicated, the code comes from the International Obfuscated C code contest.
> The interpreter now begins sliding from its current white codel, in the new direction of the DP, until it either enters a coloured block or encounters another restriction.
The npiet interpreter, instead, rewinds its position to the last colored codel upon peeking through whitespace. One of these days, I intend to add that behavior as an option to the lexer in my Piet compiler[1], but I haven't bothered yet.
Following the spec, the program is a trivial nonhalting loop because the extreme corners of almost all blocks are white-adjacent. Writing complex Piet programs to target multiple interpreters and compilers is quite the challenge, as they've all got subtly different undocumented interpretations of the spec. I think that the output of my Piet backend is more or less interpreter-agnostic, but I've only dug into the details of three or four other interpreters.
However, another question is how many of such random images would actually do something "meaningful".
I think this truly deserves a CS Ig Nobel Prize, if there were one, for making people laugh and then making people think.
While impressive organically, it sounds easy when targeted; we could design a programming language where an image of Mona Lisa prints "hello world" - and claim a similar feat.
Perhaps the reverse is more interesting - programmers accidentally wrote a language that could treat real world abstract art as valid input.
Isn't that what happened here?
I.e. that “programmers accidentally wrote a language that could treat real world abstract art as valid input” - and to me it’s more interesting than what grand-grandparent is describing.
I think in this case, there is a coincidence on both sides? Like, the language or the painting could have been different such that the painting would run, but what it would do wouldn't be a recognizable task.