Skip to main content
8 of 8
added 1516 characters in body
SnoringFrog
  • 1.8k
  • 19
  • 13

#6 Languages, 38 / 6^3 = 0.17592̅5̅9̅ ###Whitespace, Brainfuck, Ruby, Labyrinth, Foo, Seriously

Legend:

£: tab

: space

§: 0x7f

puts•2;#4!@•-[>+<-----]>6.§"5"•£ £ •£ 

This contains unprintable characters, so here's the hexdump:

7075747320323b23342140202d5b3e2b3c2d2d2d2d2d5d3e362e7f22352220090a090a20090a

##Explanation:

###Whitespace

Try it online. (Note: my program omits the closing three linefeeds to terminate the program, I wrote/tested this on Whitelips and that produces the proper output there, but does not on Try It Online, so the linked program has those two characters added. As far as I can tell, some interpreters let you do that, others get stuck in an infinite loop without the explicit termination)

(omitting ignored characters)

spacespacespacetabenter: push a 1 onto the stack

tabenterspacetab: output the top of the stack

###Ruby

Shouldn't need explaining. Prints 2, treats the rest of that line (ergo, the brainfuck program) as a comment, treats the rest of the file as empty.

###Brainfuck Try it online.

Requires an interpreter that supports underflow. Underflows the first cell to 255 then uses that for a loop counter to generate 51, which is the ascii code for 3.

###Labyrinth Try it online.

(omitting the last two lines for legibility because they are never reached)

puts•2;#4!@ -[>+<-----]>6.§"5"•£ puts• skipped 2 push 2 onto stack ; pop 2 from stack # push current stack depth (0) to stack 4 push 4 to stack ! print top of stack as integer @ program terminates 

###Foo Try it online.

The only thing that affects output is "5", which prints 5.

###Seriously Try it online.

puts•2;#4!@ -[>+<-----]>6.§"5"•£ puts•2;#4!@ -[>+<-----]> assorted stack manipulation that doesn't affect this program 6 push 6 to the stack . output top of the stack § (0x7f) terminate program 
SnoringFrog
  • 1.8k
  • 19
  • 13