When you run your program first, it should print an integer sequence. The second run should print the 'Mary had a little lamb' song. The third run should produce an ASCII image file.
Scoring
Your score will be the sum of your bytes of code and any file content at the start of each of the 3 runs. Lowest score wins.
For example, myprog
is 1500 bytes and does not change its size, but writes a 4
bytes file each run so it knows what to do on the next run. The score would be
1500 + (1500+4) + (1500+4) = 4508.
Output
The first output is this sequence of 133 integers, separated by single spaces:
0 89 98 179 188 197 269 278 287 296 359 368 377 386 395 449 458 467 476 485
494 539 548 557 566 575 584 593 629 638 647 656 665 674 683 692 719 728
737 746 755 764 773 782 791 809 818 827 836 845 854 863 872 881 890 908
917 926 935 944 953 962 971 980 1079 1088 1097 1169 1178 1187 1196 1259
1268 1277 1286 1295 1349 1358 1367 1376 1385 1394 1439 1448 1457 1466 1475
1484 1493 1529 1538 1547 1556 1565 1574 1583 1592 1619 1628 1637 1646 1655
1664 1673 1682 1691 1709 1718 1727 1736 1745 1754 1763 1772 1781 1790 1808
1817 1826 1835 1844 1853 1862 1871 1880 1907 1916 1925 1934 1943 1952 1961
1970
The second output is this text exactly (including capitals, punctuation, and white space - the inconsistent punctuation is intentional):
Mary had a little lamb,
Little lamb, little lamb,
Mary had a little lamb,
Its fleece was white as snow
And everywhere that Mary went,
Mary went, Mary went,
Everywhere that Mary went
The lamb was sure to go
It followed her to school one day
School one day, school one day
It followed her to school one day
Which was against the rules.
It made the children laugh and play,
Laugh and play, laugh and play,
It made the children laugh and play
To see a lamb at school
The third output is this image in PPM ASCII(P3) format left in a file called
blue.ppm
. This is the image in PNG format:
The PPM file should look something like this:
P3 50 50 255
255 255 255 255 255 255 255 255 255 255 255 255 ...
...
255 255 255
There is a copy of the full PPM file here.
Example run (on Linux)
# ls
myprog
# interpreter myprog
0 89 98 179 188 197 269 278 287 296 359 ...
# interpreter myprog
Mary had a little lamb,
Little ...
# interpreter myprog
# ls
blue.ppm
myprog
# cat blue.ppm
P3 50 50 255
255 255 255 255 255 ...
Rules
- Your code may modify itself.
- Running the program a fourth time is undefined behaviour.
- You may write to a file in the current directory, but the size of this file will add to your score at the start of each run. The final PPM file is excluded from this.
- The first two outputs are to stdout (or similar). The last output is written to a file, with nothing sent to stdout.
- The first two outputs may optionally have a trailing white space character (e.g. space or line feed).
- You may not use compression or image libraries. You may use your own compression or image functions but this code must be included in your program.
- The standard loopholes are prohibited.