top | item 40142032

(no title)

mellonaut | 1 year ago

The last program on the examples page⁰ truly is amazing:

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

discuss

order

lifthrasiir|1 year ago

If you relax the "functionally" condition enough, it has been already shown that most paint splatters (including art pieces) are actually valid Perl [1].

[1] https://www.mcmillen.dev/sigbovik/

nightpool|1 year ago

I think the issue in this case is that the Perl programs were "really" created by OCR hallucinations, not graphic artists. Piet, on the other hand, is really executing the painting itself.

dylan604|1 year ago

and yet, I can write a line of Perl today that I will not remember how/why it does what it does tomorrow. I don't know if this says more about me or the language other than I don't do it enough any more. However, the fact that paint splatters are better than I am is just proof that it is not the language for me

mock-possum|1 year ago

> Piet J. (yes, that's his real name) was browsing art in a small gallery and saw a work which reminded him of a Piet program. He spoke to the artist, who claimed to know nothing about the language. Piet took a photo of the artwork (left), converted it into a clean image file using close colours from the Piet palette (right), and tried running it.

> 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.

gnfargbl|1 year ago

I did enjoy the one which computes π;

> Naturally, a more accurate value can be obtained by using a bigger program.

I think that's a first for me.

boothby|1 year ago

Sadly, that depends on a discrepency between npiet and the current Piet spec:

> 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.

[1] https://github.com/boothby/repiet/

blauditore|1 year ago

I wonder what the chances are that a simple painting like this (a few large rectangular blocks) is a valid program. From skimming the documentation, I tend to think even that every such image would run without error, given that "Any operations which cannot be performed (such as popping values when not enough are on the stack) are simply ignored, and processing continues with the next command."

However, another question is how many of such random images would actually do something "meaningful".

indigoabstract|1 year ago

> It ran! [...] This is probably the first time in history that a graphic artist has painted a functionally workable computer program by accident.

I think this truly deserves a CS Ig Nobel Prize, if there were one, for making people laugh and then making people think.

thih9|1 year ago

> This is probably the first time in history that a graphic artist has painted a functionally workable computer program by accident

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.

cinntaile|1 year ago

> 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?

abrookewood|1 year ago

I just read that ... incredible. I mean the language itself is just bizarre, but that story tops everything.