Settings

Theme

Sample programs in the Piet programming language

dangermouse.net

130 points by journeeman 10 years ago · 28 comments

Reader

kibwen 10 years ago

For those using Piet in production, what async web framework do you favor? Warhol seems pretty popular, but Schiele has me impressed with its expressiveness. We're currently using Dali, though I'm a bit dissatisfied at how surreal its API is.

  • skoczymroczny 10 years ago

    I'm using Monet, because I want to make an impression on my clients.

  • jentulman 10 years ago

    We just throw some Pollock on the box at random, but there's some more detailed Seurat dotted around the stack.

  • koliber 10 years ago

    I'm not familiar with the others, but Dali is my choice for surreal-time operating system development.

  • iamcreasy 10 years ago

    We are using Apache Van^Gogh. But it's trendy to use Hirst though.

    • michael-the1 10 years ago

      Love Van^Gogh in combination with a Munch cache. Recently went to the Van^Gogh conference where they had a great talk on this topic. [0]

      [0] http://www.vangoghmuseum.nl/en/whats-on/exhibitions/past-exh...

      • vog 10 years ago

        I really love this kind of conferences, where things are almost hands-on and you can see the actual source code of all(!) presented projects.

        They even embrace showing source code, and all discussion is centered around a specific piece of code.

        These are qualities I miss at most conferences.

    • kibwen 10 years ago

      I suspect this is being downvoted because VG has a reputation for being notoriously unstable.

  • imrehg 10 years ago

    We get popular results with Banksy, though come to think of it, not sure if anyone knows who our programmers are...

  • logicrook 10 years ago

    I'm surprised async web framework as old as Warhol, Schiele or even Dali can keep up with the modernities and constant advances of JS and html5. Aren't they too old-fashioned?

    And how can Dali be more surreal than using a language designed to animate monkeys on webpages for writing full-blown applications?

  • vog 10 years ago

    I prefer the Hundertwasser framework, developed by 100water. Not sure how they achieved that, but this framework almost forces me to produce beautiful code.

  • dvirsky 10 years ago

    You should definitely try Pollock. It's a bit rough, and the code is messy and hard to understand - but very powerful.

  • TheOtherHobbes 10 years ago

    I've had good results from Emin. But it can be a bit temperamental.

  • szatkus 10 years ago

    I was little terrified after reading the first sentence...

  • mihaifm 10 years ago

    Do you have references for these? Google doesn't give me much.

leni536 10 years ago

An "actual" piet quine:

http://mamememo.blogspot.hu/2009/10/piet-quine.html

For me the image doesn't load, it's archived on stackexchange fortunately:

https://codegolf.stackexchange.com/questions/23193/output-an...

    $ ../npiet-1.1/npiet quine.gif > quine2.gif
    $ diff quine.gif quine2.gif
It's freakin' impressive.
greenpenguin 10 years ago

I had an interesting time writing a JIT for Piet some time ago. Piet is a pretty weird language in a few non-obvious ways. From what I remember:

* Execution moves between blocks of colour. Flood fill algorithms are a valid compiler optimisation!

* Execution can move left/right/up/down. You can't necessarily tell what will be executed without doing it. The 'codel chooser' stuff means you can exit a colour block in two different ways depending on program state (plus left/right/up/down, so 8 ways total...).

* Instructions are encoded in the difference between colour blocks.

* Piet is otherwise a fairly straightforward stack machine.

frobozz 10 years ago

I wouldn't trust these programs to work. The fibonacci one certainly doesn't.

When the explanatory line in the fibonacci example first hits the left hand side of the program, the Direction Pointer appears to be being rotated anti-clockwise.

Were it rotated clockwise, as-per the spec, it would go up, hit the black block above, and eventually end up in an infinite loop.

The command executed on entry to that block is PUSH (pale to normal yellow), so it shouldn't have any effect on DP.

S4M 10 years ago

I'm wondering if there is a practical use of such a graphic language. I am thinking of printing the pictures associated with the code, put them somewhere, and other people could take some photos of those pictures with their smartphones and run the corresponding code. That might be useful for a game but I can't think of anything yet.

  • ball_of_lint 10 years ago

    Like a qr code but without needing internet. Could be cool for geocaching

    • dTal 10 years ago

      QR codes don't need internet. They just get less reliable the bigger you make them, so often people just put URLS in them and put the real info at the URL. There are plenty of "historical site" QR codes around here that have a short paragraph of info in them.

AstroJetson 10 years ago

I was going to attempt a humorous comment of "I prefer a language that supports recursion, so I use Escher". But then my brain went, "think there already is an Escher". There is one, it's from 1995.

Are programming languages about to hit the same problem as musicians, thinking up that cool but unused band name?

Radle 10 years ago

The Pi calculator gave me the rest.

  • pygy_ 10 years ago

    http://www.dangermouse.net/esoteric/piet/piet_pi_big.png

    > Richard Mitton supplies this amazing program which calculates an approximation of pi... literally by dividing a circular area by the radius twice. Richard says:

        The output is printed without the decimal
        point after the 3.
    
        Naturally, a more accurate value can be
        obtained by using a bigger program.
qznc 10 years ago

Any museum wants to host an exhibition?

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection