» About     » Archive     » Submit     » Authors     » Search     » Random     » Specials     » Statistics     » Forum     » RSS Feed     Updates Daily

No. 559: Pietfield

First | Previous | 2010-11-29 | Next | Latest

Pietfield

First | Previous | 2010-11-29 | Next | Latest

Permanent URL: https://mezzacotta.net/garfield/?comic=559

Strip by: Heikki Kallasjoki

Garfield: Jon, I need to express myself.
Garfield: So I've taken up painting.
Garfield: I call it "Stupid in Green."

The author writes:

A Garfield strip about painting, slightly tweaked to also be a Piet program that prints out "Garfield".

In order to be more "Piet-compatible", I've converted the whole strip to the 18-colour Piet palette, mostly in a non-dithered fashion, except for the cat, whose trademark orange colour is very non-existent in the Piet palette. The dithering does make him stand out a bit, though.

The program itself runs, at least in npiet:

$ ./npiet pietfield.png
Garfield

And is textually basically this:

push(10); -- '\n'
push(100); -- 'd'
push(108); -- 'l'
push(11621); -- 11621 % 256 == 'e'
push(105); -- 'i'
push(102); -- 'f'
push(114); -- 'r'
push(3169); -- 3169 % 256 == 'a'
push(71); -- 'G'

push(1057); -- \
duplicate; -- | push(0) */
sub; -- /
push(10);
push(1);
roll; -- put the 0 under the '\n'
{ loop: }
duplicate; -- \
not; -- |
not; -- | flip CC if top-of-stack nonzero
switch; -- /
{ terminate unless CC flipped above }
out(char); -- pop and output
{ goto loop }

The large numbers (11621, 3169, 1057) are places where I used existing background blobs as data. The program assumes ASCII, and that out(char) will output only the 8 lowest bits; if it outputs, say, Unicode codepoints, you'd get "G<TELEGU LETTER VOCALIC LL>rfi<TIFINAGH LETTER YAZZ>ld" out.

Here is the trace output from npiet ("-tpic -tpf 3", pietfield-trace.png). It's a bit on the large side (1800×534 pixels), but even so the loop part is a mess. Still, you can see approximately how it goes through the strip.

npiet trace

Original strip: 2003-10-21.