TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Sample programs in the Piet programming language

130 pointsby journeemanabout 9 years ago

8 comments

kibwenabout 9 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.
评论 #11342922 未加载
评论 #11342947 未加载
评论 #11343285 未加载
评论 #11342865 未加载
评论 #11343436 未加载
评论 #11343221 未加载
评论 #11342844 未加载
评论 #11342752 未加载
评论 #11343667 未加载
评论 #11343349 未加载
评论 #11342886 未加载
leni536about 9 years ago
An &quot;actual&quot; piet quine:<p><a href="http:&#x2F;&#x2F;mamememo.blogspot.hu&#x2F;2009&#x2F;10&#x2F;piet-quine.html" rel="nofollow">http:&#x2F;&#x2F;mamememo.blogspot.hu&#x2F;2009&#x2F;10&#x2F;piet-quine.html</a><p>For me the image doesn&#x27;t load, it&#x27;s archived on stackexchange fortunately:<p><a href="https:&#x2F;&#x2F;codegolf.stackexchange.com&#x2F;questions&#x2F;23193&#x2F;output-an-image-of-your-source-code-not-quite-a-quine" rel="nofollow">https:&#x2F;&#x2F;codegolf.stackexchange.com&#x2F;questions&#x2F;23193&#x2F;output-an...</a><p><pre><code> $ ..&#x2F;npiet-1.1&#x2F;npiet quine.gif &gt; quine2.gif $ diff quine.gif quine2.gif </code></pre> It&#x27;s freakin&#x27; impressive.
greenpenguinabout 9 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:<p>* Execution moves between blocks of colour. Flood fill algorithms are a valid compiler optimisation!<p>* Execution can move left&#x2F;right&#x2F;up&#x2F;down. You can&#x27;t necessarily tell what will be executed without doing it. The &#x27;codel chooser&#x27; stuff means you can exit a colour block in two different ways depending on program state (plus left&#x2F;right&#x2F;up&#x2F;down, so 8 ways total...).<p>* Instructions are encoded in the difference between colour blocks.<p>* Piet is otherwise a fairly straightforward stack machine.
frobozzabout 9 years ago
I wouldn&#x27;t trust these programs to work. The fibonacci one certainly doesn&#x27;t.<p>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.<p>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.<p>The command executed on entry to that block is PUSH (pale to normal yellow), so it shouldn&#x27;t have any effect on DP.
S4Mabout 9 years ago
I&#x27;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&#x27;t think of anything yet.
评论 #11347501 未加载
AstroJetsonabout 9 years ago
I was going to attempt a humorous comment of &quot;I prefer a language that supports recursion, so I use Escher&quot;. But then my brain went, &quot;think there already is an Escher&quot;. There is one, it&#x27;s from 1995.<p>Are programming languages about to hit the same problem as musicians, thinking up that cool but unused band name?
Radleabout 9 years ago
The Pi calculator gave me the rest.
评论 #11342976 未加载
qzncabout 9 years ago
Any museum wants to host an exhibition?