This answer is a collaboration between myself and user 10000000001000000000.
#10 years, 12 languages, 2430 bytes
This answer is a collaboration between myself and user 1000000000.
A brief language list:
Brainfuck 1993
Befunge 1993
Piet 2001
Whitespace 2003
Braincopter 2005
Grass 2007
Starry 2008
Paintfuck 2008
Brainbool 2010 (11111011010)
Python 2.7.2 2011
Fission 2014
Brainflak 2016
Here is the code:
P3v="";print(sum([ord(x)for x in"~~~~~~~~~~~~~~~y"]));"""{}{} + + +---[. + +.. '.. +. +.. +. +. +.] + + + + + + +(((((()()()()){}){}){}){})({({} +-[<() + + + + + + +>-()])}{}<[. + + + + + + + +..------- ` +.[-]]>)[< '
17 12
# > 7*::,8 +:,,2 +,@<>R"2014";]*ne*e*es*s*swWWW*swWWWW*sw*e*e*e*eeev*wn*n*n*n*ne*e*se*s*s*s*sWWwWWWw**e*eeee*vwn*n*n*n*ne*e*se*s*s*s*sWWWw*eeee*e*ne*n*nWWWWWw*ne*nWWWWWWw*w*sw*se*sWWWWWWWw*s*WWWWWWwwwWWWWWWWWWWwWWWWWWWWWWwvwWWWwWWWWwvwWWwWWWwvwWWwWWWwvwWWwWWWwvwWWwwwwwwwwwwwWWWwWWWWWwWWWWWWWwWWWWWWWWWwWWWWWWWWWWWWWWWwWWWWWWWWWWWWwv `
255 0 255 255 0 192 192 0 192 192 0 192 192 192 255
255 192
255 255 192
255
255
0 255 255 0 255 255 0 255 255 0 255 255 0 192 192 192 255 255 255 255 255 0 192 192 0 0 255 255 255
255 0 0 255 0 192 192 0 192 192 0 192 192 192 255 255 192 255 255 192 255 255 192 255 255 0 255 255 0 255 255 0 255 255 0 192 192 255 255 255 255 255 255 255 255 255 255 255 255 0 192
192 0 0 255 0 192 192 0 192 192 0 192 192 0 192 192 192 255 255 192 255 255 192 255 255 0 255 255 0 255 255 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0 0
255 0 192 192 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 255 255 255 255
255 0 192 192 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 255 255 0 192
192 0 192 192 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 255 255 0 0
255 0 192 192 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 255 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 255 255 255 255
255 0 192 192 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 255 255 0 192
192 0 192 192 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 255 255 0 0
192 0 192 192 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 255 255 0 0 0 0 0 0 255 255
255 0 192 192 0 0 255 0 0 255 255 255 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255 0 0 255 0 0 255 0 255 255 0 0 0 0 192 192 0 0
255 0 192 192 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 255 255 0 0 0 0 192 192 0 192 192
# """
In order to fit this within a response I will forgo entire TIO links and will rather just post a link to a valid interpreter where the code may be input by the user. Here is a Pastebin link for that purpose.
##Piet
The PPM file format, one of the image formats that the Piet interpreter we used can read from, has a plaintext ASCII version. Using this we were able to embed the code of other languages as junk in the image file read by Piet and Braincopter.
The image looks like this:
Not all of the image is important for Piet. Here is a version with a line highlighting the path that Piet follows through the code:
Despite somewhat convoluted methods to create the program the program itself is quite simple. Along the top of the image it pushes 1 10 10 10 2
to the stack; along the side it multiplies thrice and adds once. In the bottom corner it outputs the result (2001) and then halts.
Braincopter is the other visual language. It also relies on the same ppm
image file to run. Because of very harsh restrictions in npiet our Braincopter code can only use a subset of the original Braincopter operations. We are restricted to using colors that are valid ops in Piet. This removes the -
operator from Braincopter.
Here is the path traced out by the Braincopter code:
The Braincopter program is a bit strange because of the lack of a -
operator. The walls of cyan and dark cyan serve to redirect the pointer but other than that it is identical to the following brainfuck:
++++++++++++++++++++++++++++++++++++++++++++++++++.>++++++++++++++++++++++++++++++++++++++++++++++++..+++++.
This prints 2005.
Paintfuck is the third visual programming language on our list however instead of taking in a image and outputting text, Paintfuck takes in text and outputs an image.
Since Paintfuck ignores irrelevant characters as no-ops most of the code is unimportant. The relevant section of the code is:
nsn**ne*e*es*s*sw*sw*sw*e*e*e*eee*wn*n*n*n*ne*e*se*s*s*s*sww**e*eeee*wn*n*n*n*ne*e*se*s*s*s*sw*eeee*e*ne*n*nw*ne*nw*w*sw*se*sw*s*wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwnsn**ne*e*es*s*sw*sw*sw*e*e*e*eee*wn*n*n*n*ne*e*se*s*s*s*sww**e*eeee*wn*n*n*n*ne*e*se*s*s*s*sw*eeee*e*ne*n*nw*ne*nw*w*sw*se*sw*s*wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
While they are not no-ops the w
s at the end of the code do nothing. They are there for the grass portion of the solution. n
,e
,s
, and w
are used to move around the image and *
is used to plot a point at certain location. The program outputs:
A bigger version:
##Brainfuck
Like Paintfuck Brainfuck ignores most characters. Once again here are the important ones:
[]+++---[.++....+.+..+.+.+.]++++++++-[<+++++++>-]<[.++++++++..-------+.[-]]>[<>,+,,+,<>]
Most of this is further irrelevant by circumstance and just happen to be characters that some other language needed. The slimmer version of this code is:
+++++++[<+++++++>-]<[.++++++++..------.[-]]
This pretty simply prints 1993
.
Brainbool is very similar to Brainfuck in its character selection. The big difference that allows the two to be woven together is the lack of a -
in Brainbool. The important characters for Brainbool are:
[]+++[.++....+.+..+.+.+.]++++++++[<+++++++>]<[.++++++++..+.[]]>[<>,+,,+,<>]
Brainbool and brainfuck's outputs are mutually exclusive. Brainbool hides its output in the second set of []
. Brainfuck encounters +++---
before it reaches the [
setting it to zero and causing it to skip the output, while Brainbool only sees +++
setting it to 1 causing it to pass through the loop. Similarly Brainbool is set to zero at the 4th loop causing it to skip while Brainfuck enters the loop with a value of 49.
Since Brainbool does not have decimal output it outputs the 2010 in binary:
11111011010
##Fission
The only part of the code that is important for fission is:
R"2014";
The R
summons in a atom moving to the right, the "2014"
prints 2014
and the ;
halts execution.
##Befunge
Befunge only passes through the following characters:
P3v
7
> 7*::,8 +:,,2 +,@
The P3
are necessary to make a valid .ppm image for piet, and cumulatively push a 3 to the stack. the v
is placed to redirect the the pointer downwards. It then passes through the 7
in the 17
used to indicate the width of the .ppm image. The >
redirects the pointer to the right. 7*
multiplies the top of the stack by 7 leaving 49 (ASCII value of 1
) on the top of the stack. ::
duplicates the top of the stack twice. The 1
is output by ,
. 8 +
adds 8 to the top incrementing to ASCII 9
. :,,
outputs 9
twice. 2 +
increments the ASCII 1
to an ASCII 3
and ,
prints. Finally @
terminates the program.
All in all it prints 1993
.
Whitespace, as the name might suggest, only uses whitespace in its programs. This is what the Whitespace interpreter sees:
[Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][LF]
[Space][Space][Space][LF]
[Space][Space][Space][Space][Space][LF]
[Space][Space][Space][Tab][Tab][Tab][Tab][Tab][Space][Tab][Space][Space][Tab][Tab][LF]
[Tab][LF]
[Space][Tab][LF]
[LF]
[LF]
[Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][LF]
[Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][LF]
[Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][LF]
[Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][LF]
[Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][LF]
[Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][LF]
[Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][LF]
[Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][LF]
[Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][LF]
[Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][LF]
[Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][LF]
[Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][Space][LF]
[Space][Space][Space][LF]
Most of what this code does is inconsequential to the execution of the program (all the lines containing only spaces simply push zero to the stack). The important part:
[Space][Space][Space][Tab][Tab][Tab][Tab][Tab][Space][Tab][Space][Space][Tab][Tab][LF]
[Tab][LF]
[Space][Tab][LF]
[LF]
[LF]
The first line pushes 2003 to the stack. After that [Tab][LF][Space][Tab]
prints out the top of the stack (2003) as a number. Finally the last three linefeeds end the program execution.
##Grass
Grass ignores all character until the first w
in the file and after that all characters that are not w
, W
, or v
. The Grass interpreter reads:
wWWWwWWWWwv
wWWwWWWwv
wWWWwWWWWWwWWWWWWwwwWWWWWWWwWWWWWWwwwWWWWWWWWWWwWWWWWWWWWWwv
wWWWwWWWWwv
wWWwWWWwv
wWWwWWWwv
wWWwWWWwv
wWWwwwwwwwwwwwWWWwWWWWWwWWWWWWWwWWWWWWWWWwWWWWWWWWWWWWWWWwWWWWWWWWWWWWwv
The first line defines a function that adds two to whatever it is passed. The second line defines a function that adds four to whatever it is passed. The third defines a function that prints two plus the argument, the prints the argument twice, then finally prints seven plus the argument (Grass prints out characters based on ASCII value). The fourth, fifth and sixth lines define functions that add eight, add 16, add 32, and add 64 to their argument, respectively. The final line defines the main function which takes the character w
(the only predefined number in Grass, ASCII value 119) and adds 185 to it using the add functions defined in the program as well as the built in add one function. Grass wraps numbers at 256 and so the result is 48 (corresponding to the character 0
). The function then passes this to the function of the third line which prints out 2007.
##Starry
Starry ignores everything except for space, +
, *
, .
, ,
, `
, and '
. Thus the starry interpreter sees only:
+ + +. + +.. '.. +. +.. +. +. +. + + + + + + + + + + + + + + +. + + + + + + + +.. ` +. '
*, +,, +,************************************************* `
However, the label and jump instructions are used to skip sections of the code which could cause problems if run, so the code is effectively this:
+ + +. + +.. ' ` +. ' `
This code pushes two to the stack, duplicates it twice and then pops and prints one of them as a number. Then pushes zero, duplicates it and prints both zeros as numbers. Next it pops one of the twos and jumps and then pushes seven to the stack and pops and prints is as a number. Finally it pops the last two on the stack and jumps to the end of the program.
##Python 2.7.2
The Python code follows the format:
P3v="";print(sum([ord(x)for x in"~~~~~~~~~~~~~~~y"]));"""..."""
where ...
stands in for all of the other junk.
The first line, P3v=""
is there because to be a valid .ppm
file our code must start with P3
this will normally error but if we tell python it is a variable declaration it will ignore it.
Next we have to print 2011
. However because of the way that a .ppm
is formatted we cannot include any numbers in this line. In order to get around this we sum up all of the ASCII values of the string "~~~~~~~~~~~~~~~y"
and print the result. Finally we use the triple quotes of a multiline comment so that python ignores everything else.
We saved the best for last.
Brainflak, like others, ignores most characters. The relevant characters are:
(([()])){}{}[](((((()()()()){}){}){}){})({({}[<()>()])}{}<[[]]>)[<><>]
The python code, (([()]))
, pushes -1 to the stack twice so it needs to be removed before the program begins processing.
After that Brainbool uses a []
nilad which does nothing and the program begins.
(((((()()()()){}){}){}){})({({}[<()>()])}{}<[[]]>)
pushes 2016. The last [<><>]
is remnants of Befunge and Brainfuck but luckily does nothing.
When the program terminates it prints the contents of the stack, that is it prints 2016
.