447 points · by andsoitis · 2y ago · 71 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”
> 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
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 wish the language structure were designed in a way that anything that’s “written” with it would look like a Mondrian painting.
>What does an algorithm look like?
Is there a real-world possibility of creating something like to _The Glass Bead Game_ from Herman Hesse's novel (originally published as _Magister Ludi_)?
As a visually oriented person, I'd like to think so, and have actually tried to use such tools:
https://community.carbide3d.com/uploads/default/original/3X/...
but the danger has been, for want of an unambiguous answer to the afore-mentioned question, they always run the risk of:
https://blueprintsfromhell.tumblr.com/
https://scriptsofanotherdimension.tumblr.com/
and it's hard striking a balance between visual expressiveness and modularity (which all-too readily results in the wall of text which one is presumably trying to avoid).
Writing Piet by hand is a fun way to explore this. Sergei Lewis[1] and I[2] have each written tools to generate Piet code. Sergei's assembler makes much nicer looking code than my Piet backend. All you can really see from my compiler's output is that I'm really lazy and used a trampoline[3]
[1] http://www.toothycat.net/wiki/wiki.pl?MoonShadow/Piet
It is easy similarly to say that a for loop is the mental conception of "one thing going over a bunch of other things", which has a visual representation like "100" -> "010" -> "001".
I wonder then if its possible to create a language where one defines these constructs purely as visual transformations.
From there, we spatialize and logicize concepts like "mine," "like me," "unlike me," "other," "in front," "back," and "forward."
Additionally, at the risk of igniting flames, I find it interesting to ponder the significance of gender in the current zeitgeist. Could attacking gender at a political level be a form of assault on sense-making, tugging at the roots of ontological logic centers in the brain? Might this destabilize civilization centers deemed as enemies by some? Feels like the right exploit from a hacker mentality.
What if my computing model rely on quantum phenomenon ? Maybe some of them don't have good visual representation. But it's a guess. I don't know...
Regarding the global idea of your comment: what about languages such as J it APL or BQN ? In such languages each character is an atomic part of algorithms (in j, two characters are used to implement dynamic IF for instance. One character only is used to define the dimensional depth of each part of algorithms). In this way, iversonnian languages can be seen as general and pure visual representation of algorithms once you consider each J or APL character as an arbitrary glyph.
If what I am saying is true (that human language maps to transformations of space-time) then this theoretical computer should be able to represent quantum phenomena.
Im not familiar at all with APL or BQN but I think I understand what youre saying. I think the main point here isnt simply that you can represent programs visually, but that the visuals do exactly what you see. A "combine" instruction for example would literally be the visual of two objects with empty space transforming to the two objects being together.
And we all thought QR codes were useful...
Now that's deep.
I'm dating myself with this reference, but some of us old data fogeys might be wondering (well, I am, at any rate) when Piet came out compared to Pentaho's OLAP engine called Mondrian (https://mondrian.pentaho.com/documentation/olap.php)...
Would make for a great present as print!
More accurately, a programmer accidentally came up with a language that can run on real world paintings
Simplified Piet interpreter written in Python - https://news.ycombinator.com/item?id=33130954 - Oct 2022 (2 comments)
Piet, a programming language in which programs look like abstract paintings - https://news.ycombinator.com/item?id=21913483 - Dec 2019 (19 comments)
Piet – A programming language in which programs look like abstract paintings - https://news.ycombinator.com/item?id=13503841 - Jan 2017 (12 comments)
Sample programs in the Piet programming language - https://news.ycombinator.com/item?id=11342442 - March 2016 (27 comments)
Piet – visual programming language - https://news.ycombinator.com/item?id=11266653 - March 2016 (1 comment)
Piet Program Gallery - https://news.ycombinator.com/item?id=7727702 - May 2014 (4 comments)
Enterprise Piet - https://news.ycombinator.com/item?id=4698737 - Oct 2012 (39 comments)
Piet: programming with pixels - https://news.ycombinator.com/item?id=2430357 - April 2011 (3 comments)
Piet is a programming language, whose programs look like abstract art. - https://news.ycombinator.com/item?id=1166462 - March 2010 (28 comments)
Piet: a programming language in which programs look like abstract paintings - https://news.ycombinator.com/item?id=235975 - July 2008 (1 comment)
And you thought BrainFk was hard to understand... - https://news.ycombinator.com/item?id=139872 - March 2008 (2 comments)
---
Bonus:
Mondrian painting has been hanging upside down for 75 years - https://news.ycombinator.com/item?id=33370228 - Oct 2022 (71 comments)
Wish the sample programs were shown in action.
Save the image of the program and import it (e.g. https://www.toothycat.net/~sham/fizzbuzz.png ). You can then step through it.
There are several other implementations listed at https://esolangs.org/wiki/Piet