Hi\n

From Esolang
Jump to: navigation, search

hi\n is a joke language created by User:Xavo in May 2015. It is a completely useless language that does the following things:

  • It instantiates the string "eat pie" 98 times using a for loop.
  • It sets the variable 'x' to a string with exactly 1,000,000 'a's.
  • It sets the variable 'squiggly' to the square root of 5.
  • Most importantly, it prints 'hi' with a trailing newline.

How to write an interpreter

The program must do the following things in this order to be considered a hi\n interpreter:

  1. It must instantiate the string "eat pie" exactly 98 times, using a for loop.
  2. It must set the variable 'x' to a string containing exactly 1,000,000 'a's.
  3. It must set the variable 'squiggly' to the square root of 5.
  4. Most importantly, it must print 'hi' with a trailing newline.

Important note

  • Standard libraries are allowed.
  • It does not have to read any file at all.

Faulty Interpreter in Ruby

 for i in 1..98 do
 "eat pie"
 end
 x = "a"*1_000_000
 squiggly = Math::sqrt(5)
 print "hi\n"

Note that the square root of 5 is an irrational number and the current version of Ruby does not support this number format.

Another Interpreter

 import math
 for i in range(98):
   "eat pie"
 x = "a" * 1000000
 squiggly = math.sqrt(5)
 print("hi")

Example code

Quine:

hi

Prints "hi" with a trailing newline:

ajrv9a8mur9autrm3tum9vut9stvn93ut8ybms98ty83yf8syf

Also prints "hi" with a trailing newline:

Potato potato potato, potato potato. Potato potato? Potato! Potato potato, potato.