6 ms·
Piet: Programming language in which programs look like abstract paintings (2002)
- deleted 3y ago[deleted]
- sedatk 3y agoPiet is a milestone experiment among the esoteric programming languages, but I believe that it falls short of achieving its goal to make programs look like Mondrian paintings unless the developer really intends to do so. I wish the language structure were designed in a way that anything that’s “written” with it would look like a Mondrian painting.
- jack_riminton 3y agoYes well unfortunately Mondrian only really used the primary colours so that would be rather limiting
- wouldbecouldbe 3y agojust have to make them really big
- euroderf 3y agoBut FWIW Mondrian also showed how to convert a more conventional style into his signature style. This can be seen in Still Life with Gingerpot, numbers 1 and 2.
- btbuildem 3y agoCould encode more operators into shape ratios / proportions, line thickness etc.
- shever73 3y agoIt could be done. The FizzBuzzLang esolang uses only the words FIZZ, BUZZ and FIZZBUZZ.
- mellonaut 3y agoThe 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 https://www.dangermouse.net/esoteric/piet/samples.html [1]: https://gitlab.fabcity.hamburg/hofalab/piet-get-together https://gitlab.fabcity.hamburg/hofalab/piet-get-together
- gnfargbl 3y agoI 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.
- schoen 3y agoIsn't there an obfuscated C or Perl competition program that also estimates pi by measuring its own code in some way? Edit: Oh yes, it's "westley" from 1988: https://www.ioccc.org/years-spoiler.html#1988_westley https://www.ioccc.org/years-spoiler.html#1988_westley
- amenghra 3y agoI made a JavaScript port, that might be easier to decipher if you are more familiar with js than C: https://quaxio.com/pi.html https://quaxio.com/pi.html
- andoando 3y agoHoly shit! Ive been trying to do something just like this for ages. Wish the sample programs were shown in action.
- pyinstallwoes 3y agoWhat were you trying ?
- andoando 3y agoStill trying, but a programming language for visuals where one can define some primitive transformations like two blocks being added, a block moving through space, etc and use transformations to create bigger transformations and so on.
- pyinstallwoes 3y agoWHat have you come up with so far? Sounds interesting. I'd be happy to give ideas and bounce stuff. Just sounds cool.
- andoando 3y agoIn the very very first iteration (before I was thinking about this deeply at all), I made this. https://github.com/ando818/creativegen/blob/master/moldpieces.py https://github.com/ando818/creativegen/blob/master/moldpiece... Basically you have some basic shapes like lines, rectangles and you can "weld" them together to form a mold, which could be joined together with other molds. Then I created a pattern sequence with some basic transitions, like swapping positions or colors. https://github.com/ando818/creativegen/blob/master/pattern.py#L69 https://github.com/ando818/creativegen/blob/master/pattern.p... The program would then draw all the molds, and every 4,8,16, or whatever beats apply the transition from the pattern sequence. Ie every 4 beats swap, every 8 bits change colors. The idea was that you could form the pattern sequence quite easily and create interesting visuals that synced with music. I have some videos somewhere of this thing running, just not sure where they are. Then I started thinking rectangles are really just composition of lines, lines are just composition of points. Transitions are just compositions of other transitions and I wanted to make everything out of the same thing. 4 years later honestly I don't have much to show for it. Its proven incredibly difficult and my ideas are all over the place. I've created literally 10-20 different implementations and started all over again. This is one of them. https://pastebin.com/4J8dgAWu https://pastebin.com/4J8dgAWu The idea is that each node (pixel, object, or whatever) is a "transformer" which has a start and end which themselves are transformers with a start, end, next. Following a transformer's start transformer's next pointer should lead to its End (think input, transformation sequence, output). We run a transformer A with an instance of a different transformer B. We iterate through the nexts of A's transformer and Bs transformer concurrently, at each step we apply the transformation from the A sequence to the B sequence. So for example, image B.start = 0, B.start.next = 1. And A.start = SameTransformer (copies the same value to the output) -> Diff Transformer(flips the bit). So running A.run(B) = a new transformation that takes the sequence 0,1, and returns 0,0. This new transformer C could then of course be used elsewhere as a part of another transformation sequence. So to transform 0,0,0,0, one could simply apply C,C to get transformer whose output is 0,1,0,1. Its both linear and hierarchical, so one has the ability to jump over large steps (by immediately accessing the output, and not running through Start->End) of transformations if one is only interested in the outputs and not the computational steps that lead to that output. The hierarchy also allows the sequence to be treated as a single node as part of another sequence (hence applying Same to a subsequence can call same on everything below to copy it). Ive used 0s and 1s here but instead imagine 0=Right and 1=Up. Then you can have a sequence of nexts that is something like right->up->right-up->up and run this as the input to a transformer that simply applies Same, Diff, replicating the sequence, and then copying the last value to get right->up->right-up->up->up. So now imagine we make a transformer that flips the current bit, and the next bit (Diff, diff) and run it through the sequence 1,0,0,0,0,0. If we look at the output at each transformation step, we get 0,1,0,0,0 -> 0,0,1,0,0,0... But since were simply following the next path of any arbitrary sequence, this transformer could be run over the right-up->right->-up->up sequence, producing a visual with each of these nodes changing color one at a time. The bigger idea is to generate abstract sequences that make stuff bigger and bigger, or rotate them, or pull them apart, or replicate them in some projection etc. Of course there is a simple way to do this in existing languages that would take short of 10 seconds :-> There's still plenty to think about it. If that's confusing welcome to my world.
- donalhunt 3y agoThis is the type of thing, I'd expect to show up in a (crime) thriller, stumping the protagonist / investigators until someone deduces it's a code. And we all thought QR codes were useful...
- bocytron 3y agoThe samples page is amazing. You can see the evolution of the canvases, becoming more and more sophisticated and beautiful to took at. https://www.dangermouse.net/esoteric/piet/samples.html https://www.dangermouse.net/esoteric/piet/samples.html
- shrikant 3y ago> I would have liked to call the language Mondrian, but someone beat me to it with a rather mundane-looking scripting language. 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 https://mondrian.pentaho.com/documentation/olap.php)...
- nightpool 3y agoApparently, the exact same year.
- OscarCunningham 3y agoThis person made a quine in Piet: http://mamememo.blogspot.com/2009/10/piet-quine.html?m=1 http://mamememo.blogspot.com/2009/10/piet-quine.html?m=1. The image there is broken, but there's a copy here: https://codegolf.stackexchange.com/a/23255/103045 https://codegolf.stackexchange.com/a/23255/103045.
- renke1 3y agoWe had a small course in university on esoteric programming language. Each of us had to select a language (Brainfuck, Piet and a few others) and play around with it. I chose Piet and had a lot of fun with it, but to be honest, my small example application was not really aesthetically pleasing. I guess you have to be a Piet expert to make art with it.
- hansoolo 3y agoThis is so cool! I wonder if it is possible to get a Piet piece together, where the program returns a certain text given. Like a Piet code generator... Would make for a great present as print!
- inglor 3y agoNeeds a (1990) in the title?
- MalcolmDwyer 3y agoIt would be interesting to relax the color requirements such that you could encode a program into what looks like image noise. Sort of like steganography, but instead of hidden data, it's a hidden executable program.
- whatrocks 3y agoDiscovering Piet is a special moment of awe and confusion and wonder. Mine was captured in this chat with my friend Oz in our Computer Science podcast “The CS Primer Show”: https://show.csprimer.com/episodes/e2-dont-let-a-gpt-have-all-the-fun https://show.csprimer.com/episodes/e2-dont-let-a-gpt-have-al...
- einpoklum 3y ago> Note that "light" is considered to be one step "darker" than "dark" Now that's deep.
- nightpool 3y agoPiet is from 2009, at least. Although this page was last updated in 2018 with some new links i don't know if having the (2018) title makes sense, it feels kinda misleading
- WillAdams 3y agoThis has always raised a question to me: >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/5/b/5b0872a5666fec9b7bb6fd623c431de03263372d.jpeg 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://blueprintsfromhell.tumblr.com/ https://scriptsofanotherdimension.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).
- boothby 3y ago> What does an algorithm look like? 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 http://www.toothycat.net/wiki/wiki.pl?MoonShadow/Piet [2] https://github.com/boothby/repiet/ https://github.com/boothby/repiet/ [3] https://en.wikipedia.org/wiki/Trampoline_(computing) https://en.wikipedia.org/wiki/Trampoline_(computing)
- andoando 3y agoI have a belief that there is a 1 to 1 relationship between any algorithm, or even any mental conception, and a visual representation. I got this idea reading one of Steven's pink book, in which he says that any abstract word can be broken down into simpler words which in the end describe some spatial relationship. For example to "rekindle" is to "bring two things back together". 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.
- madcoderme 3y ago> This is probably the first time in history that a graphic artist has painted a functionally workable computer program by accident. More accurately, a programmer accidentally came up with a language that can run on real world paintings
- sdmike1 3y agoI ran into this in university and burned a late night writing a simple program. It was a really fun experience that I would recommend people try at some point!
- dang 3y agoRelated. Others? Simplified Piet interpreter written in Python - https://news.ycombinator.com/item?id=33130954 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 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 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 https://news.ycombinator.com/item?id=11342442 - March 2016 (27 comments) Piet – visual programming language - https://news.ycombinator.com/item?id=11266653 https://news.ycombinator.com/item?id=11266653 - March 2016 (1 comment) Piet Program Gallery - https://news.ycombinator.com/item?id=7727702 https://news.ycombinator.com/item?id=7727702 - May 2014 (4 comments) Enterprise Piet - https://news.ycombinator.com/item?id=4698737 https://news.ycombinator.com/item?id=4698737 - Oct 2012 (39 comments) Piet: programming with pixels - https://news.ycombinator.com/item?id=2430357 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 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 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 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 https://news.ycombinator.com/item?id=33370228 - Oct 2022 (71 comments)
- schneems 3y agoI loved this talk about building an implementation of Piet by one of the jruby maintainers https://m.youtube.com/watch?v=uKGecSc-r1o https://m.youtube.com/watch?v=uKGecSc-r1o
- chw9e 3y agoIt would be cool if you could build an autoencoder that took code in python or another less esoteric language and learned to output it into piet. Then you could do something like stable diffusion and get random algorithms.
- amai 3y agoCan Dall-E or Midjourney paint Piet programs?