236
\$\begingroup\$

This contest is officially over, the winner is jimmy23013. Congratulations!

The challenge is to make a program that prints Hello World! to stdout. The catch is that your program must have a Levenshtein distance of 7 or less from the program in the answer submitted before yours.

How This Will Work

Below I have already submitted the first answer using Python: print("Hello World!").

The next person to answer must modify the string print("Hello World!") with up to 7 single character insertions, deletions, or substitutions so that when it is run in any language that hasn't been used so far (only Python in this case) the output is still Hello World!.

For example the second answerer might use 1 substitution (r -> u), 2 deletions (in), and 1 insertion (s) to make the string puts("Hello World!") which prints Hello World! when run in Ruby.

The third person to answer must do the same thing in a new language, but using the program of the second person's answer (e.g. puts("Hello World!")) as their starting point. The fourth answer will be in relation to the third answer and so on.

This will continue on until everyone get stuck because there is no new language the last answer's program can be made to run in by only changing 7 characters. The communal goal is to see how long we can keep this up, so try not to make any obscure or unwarranted character edits (this is not a requirement however).

Formatting

Please format your post like this:

# Answer N - [language]

    [code]

[notes, explanation, observations, whatever]

Where N is the answer number (increases incrementally, N = 1, 2, 3,...).

You do not have to tell which exact characters were changed. Just make sure the Levenshtein distance is from 0 to 7.

Rules

The key thing to understand about this challenge is that only one person can answer at a time and each answer depends on the one before it.

There should never be two answers with the same N. If two people happen to simultaneously answer for some N, the one who answered later (even if it's a few seconds difference) should graciously delete their answer.

Furthermore...

  • A user may only submit one answer per 8 hour period. i.e. Each of your answers must be at least 8 hours apart. (This is to prevent users from constantly watching the question and answering as much as possible.)
  • A user may not submit two answers in a row. (e.g. since I submitted answer 1 I can't do answer 2, but I could do 3.)
  • Each answer must be in a different programming language.
    • Different versions of the same language count as the same language.
    • Languages count as distinct if they are traditionally called by two different names. (There may be some ambiguities here but don't let that ruin the contest.)
  • You may only use tabs, newlines, and printable ASCII. (Newlines count as one character.)
  • The output should only be Hello World! and no other characters (a leading/trailing newline is not an issue).
  • If your language doesn't has stdout use whatever is commonly used for quickly outputting text (e.g. console.log or alert in JavaScript).

Please make sure your answer is valid. We don't want to realize there's a break in the chain five answers up. Invalid answers should be fixed quickly or deleted before there are additional answers.

Don't edit answers unless absolutely necessary.

Scoring

Once things settle down, the user who submits the most (valid) answers wins. Ties go to the user with the most cumulative up-votes.

Leaderboard: (out of date)

(user must have at least 2 valid answers)

11 Answers

7 Answers

6 Answers

5 Answers

4 Answers

3 Answers

2 Answers

Languages used so far:

  1. Python
  2. CJam
  3. PHP
  4. Pyth
  5. Perl
  6. Befunge 98
  7. Bash
  8. Nimrod
  9. Ruby
  10. GNU dc
  11. Golfscript
  12. Mathematica
  13. R
  14. Lua
  15. Sage
  16. Julia
  17. Scilab
  18. JavaScript
  19. VHDL
  20. HyperTalk
  21. Haskell
  22. LOLCODE
  23. APL
  24. M30W
  25. Stata
  26. TI-BASIC (NSpire)
  27. ActionScript 2
  28. J
  29. PowerShell
  30. K
  31. Visual FoxPro
  32. VBA
  33. Extended BF Type III
  34. Zsh
  35. Dash
  36. Clojure
  37. NetLogo
  38. Groovy
  39. CoffeeScript
  40. Clipper
  41. B.A.S.I.C.
  42. FALSE
  43. fish (shell)
  44. GNU Octave
  45. TCL
  46. E
  47. newLisp
  48. Lisp
  49. SMT-LIBv2
  50. Racket
  51. Batsh
  52. tcsh
  53. AppleScript
  54. Mouse
  55. Pixie
  56. F#
  57. Falcon
  58. Burlesque
  59. HTML
  60. SGML
  61. M4
  62. MUMPS
  63. TeX
  64. Forth
  65. Salmon
  66. Turing
  67. bc
  68. Betterave
  69. Scheme
  70. Emacs Lisp
  71. Logo
  72. AutoLISP
  73. ///
  74. Rebol
  75. Maple
  76. FreeBASIC
  77. Vimscript
  78. ksh
  79. Hack
  80. mIRC
  81. Batch
  82. Make
  83. Markdown
  84. sh
  85. GDB
  86. csh
  87. HQ9+-
  88. Postscript
  89. Matlab
  90. Oz
  91. CASIO BASIC
  92. VBScript
  93. QBasic
  94. Processing
  95. C
  96. Rust 0.13
  97. Dart
  98. Kaffeine
  99. Algoid
  100. AMPL
  101. Alore
  102. Forobj
  103. T-SQL
  104. LiveCode
  105. Euphoria
  106. SpeakEasy
  107. MediaWiki
  108. SmallBASIC
  109. REXX
  110. SQLite
  111. TPP
  112. Geom++
  113. SQL (postgres)
  114. itflabtijtslwi
  115. RegXy
  116. Opal.rb
  117. Squirrel
  118. Pawn
  119. Scala
  120. Rebmu
  121. Boo
  122. PARI/GP
  123. Red
  124. Swift
  125. BeanShell
  126. Vala
  127. Pike
  128. Suneido
  129. AWK
  130. Neko
  131. AngelScript
  132. gosu
  133. V
  134. ALAGUF
  135. BogusForth
  136. Flaming Thunder
  137. Caché ObjectScript
  138. owl
  139. Cardinal
  140. Parser
  141. Grin
  142. Kitten
  143. TwoDucks
  144. Asymptote
  145. CAT
  146. IDL
  147. Tiny
  148. WTFZOMFG
  149. Io
  150. MuPAD
  151. Java
  152. Onyx
  153. JBoss
  154. S+
  155. Hexish
  156. yash
  157. Improbable
  158. wake
  159. brat
  160. busybox built-in shell
  161. gammaplex
  162. KTurtle
  163. AGOL 68
  164. Alice
  165. SML/NJ
  166. OCaml
  167. CDuce
  168. Underload
  169. Simplex v.0.6
  170. Minkolang 0.9
  171. Fexl 7.0.3
  172. Jolf
  173. Vitsy
  174. Y
  175. Retina
  176. Codename Dragon
  177. Seriously
  178. Reng v.3.3
  179. Fuzzy Octo Guacamole
  180. 05AB1E

(Feel free to edit these lists if they are incorrect or out of date.)

This question works best when you sort by oldest.

NOTE: This is a trial question for a new challenge type I have in mind where each answer depends on the last and increases in difficulty. Come discuss it with us in the chatroom for this question or in meta.

\$\endgroup\$
52
  • 61
    \$\begingroup\$ "Sort by oldest" is useful here. \$\endgroup\$
    – xnor
    Oct 27, 2014 at 6:39
  • 8
    \$\begingroup\$ chatroom for discussion on this question \$\endgroup\$
    – Justin
    Oct 27, 2014 at 7:04
  • 5
    \$\begingroup\$ @Mew HQ9+ prints the wrong message. But this one... esolangs.org/wiki/Huby \$\endgroup\$
    – Sp3000
    Oct 27, 2014 at 13:55
  • 17
    \$\begingroup\$ Maybe this can be interesting : migl.io/projects/hw. This list automatically the answers and display their life time. \$\endgroup\$
    – Michael M.
    Oct 27, 2014 at 15:00
  • 6
    \$\begingroup\$ @gerrit Cause I could really use 350 more answer notifications... \$\endgroup\$ Nov 4, 2014 at 1:39

184 Answers 184

1
2
3 4 5
7
10
\$\begingroup\$

Answer 73 - ///

/<vsh  o[.]c;cat;#&&alert"  "
(princ//Hello World!/);%!#bye";dnl</vsh>~

Distance 7 from answer 72.

\$\endgroup\$
9
\$\begingroup\$

Answer 16 - Julia

println("Hello World!")

Distance from 15 = 2

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Which answer 15 have you used? \$\endgroup\$
    – Beta Decay
    Oct 27, 2014 at 9:21
  • 1
    \$\begingroup\$ @BetaDecay I had linked to it, but I've changed it now that the C one was deleted. \$\endgroup\$ Oct 27, 2014 at 9:22
9
\$\begingroup\$

Answer 18 - JavaScript

alert("Hello World!");

Lev. Dist from A#17 = 5

\$\endgroup\$
6
  • \$\begingroup\$ awww, so close! you beat me by 15 secs :( \$\endgroup\$
    – user4768
    Oct 27, 2014 at 9:31
  • \$\begingroup\$ @Stacey maybe.... \$\endgroup\$
    – MAKZ
    Oct 27, 2014 at 9:32
  • \$\begingroup\$ An alert window isn't stdout...? \$\endgroup\$
    – zamnuts
    Oct 27, 2014 at 18:59
  • 2
    \$\begingroup\$ @zamnuts It is commonly accepted on PPCG to use alert in Javascript as it has no real stdout. \$\endgroup\$
    – Ingo Bürk
    Oct 27, 2014 at 19:01
  • 3
    \$\begingroup\$ @zamnuts console.log has nothing to do with stdout. It's a debug tool. Again, this is commonly accepted here. We shouldn't litter the comments of this answer with this discussion; feel free to start a discussion on meta about it (if it doesn't exist yet). \$\endgroup\$
    – Ingo Bürk
    Oct 27, 2014 at 19:05
9
\$\begingroup\$

Answer 25 - Stata

display "Hello World!"

Distance: 6 ([-> ", ]-> ", and addition of di and pl)

\$\endgroup\$
9
\$\begingroup\$

Answer 24 - M30W

say [Hello World!]

Distance: 5

\$\endgroup\$
3
  • 1
    \$\begingroup\$ the W must be capitalized to print "Hello World!". \$\endgroup\$
    – user32377
    Oct 27, 2014 at 10:18
  • \$\begingroup\$ Typo, thanks for pointing it out. \$\endgroup\$
    – Scimonster
    Oct 27, 2014 at 10:21
  • 1
    \$\begingroup\$ Well, now I know why I've never heard of M30W. +1 \$\endgroup\$
    – Pharap
    Oct 28, 2014 at 8:33
8
\$\begingroup\$

Answer 27 - ActionScript 2

trace("Hello World!")

Distance: 7 (Disp -> trac = 4, +e( = 2, +) = 1 = 4+2+1 = 7)

From Answer 26

\$\endgroup\$
2
  • \$\begingroup\$ Why 2? This is ActionScript 1. \$\endgroup\$ Oct 28, 2014 at 8:58
  • \$\begingroup\$ I used to program in AS2. I did so in flash, on the timeline. There I can have a single line of code. Then I moved to AS3, and I've been using document classes ever since. I wasn't sure whether one can use a single line of code like this in ActionScript 3, so I labelled it AS2. \$\endgroup\$
    – user32377
    Oct 28, 2014 at 9:02
8
\$\begingroup\$

Answer 36 - Clojure

;ah="*#[.>]trac":;cat<<@
(pr"Hello World!"
)

Distance 7 from answer 35

; makes the rest of the line a comment, and (pr "Hello World!") does the printing

\$\endgroup\$
1
  • \$\begingroup\$ Love the use of the commenting \$\endgroup\$
    – sydan
    Feb 13, 2015 at 11:51
8
\$\begingroup\$

Answer 60 - SGML

Heck, if HTML counts…

<vsh  o[.]c;cat;#&&alert" ">Hello World!</vsh>

Distance from Answer 59 : 7

\$\endgroup\$
2
  • \$\begingroup\$ I remember learning that HTML was SGML. This isn't true today; HTML syntax is not SGML syntax (html.spec.whatwg.org/multipage/syntax.html#parsing), so HTML is not SGML. \$\endgroup\$
    – kernigh
    Nov 21, 2014 at 20:08
  • 1
    \$\begingroup\$ @kernigh, I know. I was merely saying that if HTML counts sufficiently as a language to post an answer in it (see the preceding answer, #59), then why not SGML. \$\endgroup\$
    – msh210
    Nov 23, 2014 at 0:08
8
\$\begingroup\$

Answer 121 - Boo

#{//-##[][/]#i--#main(){println(
#//sel/.*}}
print("Hello World!") 
#;//"-##[;]#bye</>%"

Happy Halloween!

Distance 7 from Answer 120. Nothing fancy: added three # comment characters, and added rint after p.

Boo has syntax inspired by Python, but is a separate language with unique features built on the .NET CLI.

\$\endgroup\$
10
  • 1
    \$\begingroup\$ What happened to answer 120? \$\endgroup\$
    – user10766
    Oct 31, 2014 at 17:19
  • \$\begingroup\$ @hosch250 seemed to just be a typo, it was relative to 120 and linked, just mislabeled. Edited \$\endgroup\$ Oct 31, 2014 at 17:21
  • \$\begingroup\$ OK, I thought that might be the problem. \$\endgroup\$
    – user10766
    Oct 31, 2014 at 17:25
  • 1
    \$\begingroup\$ I meant to complete it like Boo Yeah! \$\endgroup\$
    – Optimizer
    Oct 31, 2014 at 17:43
  • 2
    \$\begingroup\$ Appropriate language given today's date. \$\endgroup\$
    – Amory
    Oct 31, 2014 at 21:47
7
\$\begingroup\$

Answer 9- Ruby

puts "\x48ello World!"

Distance: 4

\$\endgroup\$
0
7
\$\begingroup\$

Answer 13 - R

#[puts];
cat("Hello World!")

Distance = 5

\$\endgroup\$
0
7
\$\begingroup\$

Answer 20 - HyperTalk

answer "Hello World!"

Distance: 7

\$\endgroup\$
0
7
\$\begingroup\$

Answer 31 - Visual FoxPro

*#]trac
? "Hello World!"

Distance: 3 from Answer 30

Not tested of course, but * begins a comment and ? "String" prints String.

\$\endgroup\$
2
  • \$\begingroup\$ How on earth have you ever come across and vFox? Well done/sorry :-)! \$\endgroup\$
    – Ben
    Oct 27, 2014 at 22:20
  • 2
    \$\begingroup\$ @Ben By browsing the list of "hello world" examples on Wikipedia and looking for short ones ;) \$\endgroup\$
    – Doorknob
    Oct 27, 2014 at 23:55
7
\$\begingroup\$

Answer 70 - Emacs Lisp

;dnl<vsh  o[.]c;cat;#&&alert" ">w ".in
(print "Hello World!") ;%!#bye";dnl</vsh>~

Distance of 7 from Answer 69. Didn't need any changes to compile, but cleans up a bit.

\$\endgroup\$
3
  • 2
    \$\begingroup\$ I would've cleaned up some of the odd things like 'dnl<vsh' instead of the common comment characters. \$\endgroup\$
    – agweber
    Oct 28, 2014 at 15:12
  • \$\begingroup\$ @agweber why make things too easy? :P \$\endgroup\$
    – resueman
    Oct 28, 2014 at 15:16
  • 1
    \$\begingroup\$ @resueman Because in the question it was stated that the goal was to make the chain as long as possible. \$\endgroup\$
    – 11684
    Oct 31, 2014 at 21:17
7
\$\begingroup\$

Answer 96 - Rust 0.13

fn//[]([.]c;
main()    {
    print!("Hello World!");}
//#[;]#bye;dnl</>

Distance 6 from answer 95.

\$\endgroup\$
1
  • \$\begingroup\$ I was sluggishly monitoring this for "C" answer to finally appear in order to try Rusting it... \$\endgroup\$
    – Vi.
    Oct 29, 2014 at 21:08
7
\$\begingroup\$

Answer 107 - MediaWiki markup

{|--#[][.]#i--#main()   {puts(,
Hello World!
|--#[;]#bye;dnl</>"%

There is already HTML, SGML and Markdown. Why not MediaWiki?

You can see it here.

Distance 7 from Answer 106.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Note: The spaces after main() is a tab (introduced for Makefile). I didn't change it. \$\endgroup\$
    – jimmy23013
    Oct 30, 2014 at 6:47
  • \$\begingroup\$ Someone should get rid of it ... \$\endgroup\$
    – Optimizer
    Oct 30, 2014 at 9:49
7
\$\begingroup\$

Answer 32 - VBA

a="*#]trac":? "Hello World!"

Distance: 7 from Answer 31

Runs from the immediate window. The colon : is a line sepator that allows multiple lines of code to be written on the same line. (Anything run from the immediate window has to be a one liner.) The ? is a shortcut for printing to the immediate window.

\$\endgroup\$
7
  • \$\begingroup\$ I count more than 5: a = " is already 5, and then there is ": and the newline transformed into a space. \$\endgroup\$
    – plannapus
    Oct 27, 2014 at 12:22
  • \$\begingroup\$ You might want to dump the spaces, because right now it's 8. \$\endgroup\$
    – Scimonster
    Oct 27, 2014 at 12:26
  • \$\begingroup\$ Shoot. I forgot to remove the extra space and there is already another answer @Scimonster. \$\endgroup\$
    – RubberDuck
    Oct 27, 2014 at 12:27
  • \$\begingroup\$ I left a comment on the other answer notifying them so they can fix it after you do. \$\endgroup\$
    – Scimonster
    Oct 27, 2014 at 12:28
  • 3
    \$\begingroup\$ I like how you introduced a variable. More "programmatic" solution than just commenting some things out. \$\endgroup\$
    – agtoever
    Oct 28, 2014 at 11:02
7
\$\begingroup\$

Answer 167 - CDuce

(*#class jux{public static void main(String[] h){#
#System.Console.Writeln(//@\//Hello*}}print,cat<<#*)
print "Hello World!"(*)#X` ;}}//printputsx;//-##E;]bye</>%#*)

Distance 7 from Answer 166, removed _string

Nothing special, most difficult part was finding the language.

(* *) makes a multiline comment, print prints the string

\$\endgroup\$
6
\$\begingroup\$

Answer 17 - Scilab

disp("Hello World!")

Distance = 6 to Answer 16

\$\endgroup\$
4
  • \$\begingroup\$ I'm way late, but this won't work: MATLAB uses single quotes for strings, not double quotes... that might have derailed the whole train :( \$\endgroup\$
    – Dang Khoa
    Oct 27, 2014 at 23:47
  • \$\begingroup\$ I haven't tried running it, but changing this to Scilab might fix it \$\endgroup\$
    – Sp3000
    Oct 27, 2014 at 23:58
  • \$\begingroup\$ @DangKhoa Aww, that's too bad. But it's fixed now. \$\endgroup\$ Oct 27, 2014 at 23:59
  • \$\begingroup\$ sorry for the clumsiness, and thanks for the fix! \$\endgroup\$ Oct 28, 2014 at 8:18
6
\$\begingroup\$

Answer 50 - Racket

;@echo o#[.>]tac";cat<<;#&&alert 
(print "Hello World!");\

Distance is 7 from the previous answer. Needs to be run in the shell.

\$\endgroup\$
0
6
\$\begingroup\$

Answer 62 - MUMPS

;dnl<vsh  o[.]c;cat;#&&alert" ">
w "Hello World!";dnl</vsh>

Distance: 6

\$\endgroup\$
6
\$\begingroup\$

Answer 88 - Postscript

%#[]([.]c;main()
    /eco (Hello World!)=
%#[;]:;#bye;dnl</>

Distance: 6 insertions to answer 87.

Back to real programming languages.

\$\endgroup\$
6
\$\begingroup\$

Answer 120 - Rebmu

{//-##[][/]#i--#main(){println(
//sel/.*}}
p("Hello World!") 
;//"-##[;]#bye</>%"

Distance 7 from Answer 119

  • { and } are asymmetric string delimiters for an alternate representation of strings permitting balanced nested pairs, embedded quotes, etc. {Hey {it's} "legal"}. Add one at the beginning then two braces to create a balanced string after the .* cost 3

  • Standalone string literals not passed to any function are skipped by the evaluator, so that literal has no effect.

  • At the outset of the program, P is a single character abbreviation for PR, itself an abbreviation for PRINT. (If you wanted you could overwrite it and use as a variable in code golf and still access printing through PR, and if you overwrite that you could use PRINT. Or set X to point to the function value of P before you override it, etc.) cost 1

  • Parentheses are structural elements that can be used for arbitrary purposes (imagine if Lisp had [] and () as different "flavors" of series you could metaprogram with, with [] having the traditional "list" behavior). In the default evaluator parens just do precedence, so there's no significance to putting it around a string literal. Added a paren instead of subtracting in case it would be helpful, either way it's cost 1

  • Semicolon comments to end of line, get rid of last line using that with an insertion so that the comment comes after it. (Would have been 1 cheaper to do that with the first 2 lines but this is perhaps a better setup.) cost 1

  • Spend extra random character to join println onto main(){ cost 1

\$\endgroup\$
6
\$\begingroup\$

Answer 168 Underload

(*#class jux{public static void main(String[] h){#
#System.Console.Writeln(//@\//Hello*}}print,cat<<#*)
pint)(Hello World!)S(#X` ;}}//printputsx;//-##E;]bye</>%#*)

Distance 7 from Answer 167

\$\endgroup\$
5
\$\begingroup\$

Answer 34 - Zsh

ah="*#[.>]trac":;<<@
Hello World!
@

Distance: 7 from Answer 33.

\$\endgroup\$
0
5
\$\begingroup\$

Since I can't craft the solution I wanted to go with from the previous one, here's another solution instead:

Answer 40 - Clipper

*#//;ah="*#[.>]trac":;cat<<@
&&alert 
? "Hello World!"

NB: There is a trailing space at the end of line 2.
Distance: 6

Clipper is unique in that it has four different commenting techniques of which I've used two above:

* A comment
// A comment
&& A comment
/* A multiline
comment */

? is obviously the print command.

\$\endgroup\$
5
\$\begingroup\$

Answer 48 - Lisp

;@echo o#[.>]trac";cat<<
;#&&alert 
(princ "Hello World!");\

Distance = 7

\$\endgroup\$
3
  • 5
    \$\begingroup\$ Is that supposed to be princ? \$\endgroup\$
    – TRiG
    Oct 27, 2014 at 23:09
  • 5
    \$\begingroup\$ @TRiG It's not a typo. stackoverflow.com/questions/19756296/… \$\endgroup\$
    – Etheryte
    Oct 27, 2014 at 23:17
  • 1
    \$\begingroup\$ This doesn't say which Lisp. I guess this was meant to be Common Lisp. \$\endgroup\$
    – kernigh
    Nov 21, 2014 at 20:00
5
\$\begingroup\$

Answer 54 - Mouse

~//echo o[.>]c;cat<<;#&&alert (printf
"Hello World!"$

Distance 7 from Answer 53.

\$\endgroup\$
2
5
\$\begingroup\$

Answer 61 - M4

dnl<vsh  o[.]c;cat;#&&alert" ">
Hello World!dnl</vsh>

Distance from Answer 60 : 7

\$\endgroup\$
5
\$\begingroup\$

Answer 63 - TeX

%;dnl<vsh  o[.]c;cat;#&&alert" ">w "
Hello World!\bye";dnl</vsh>

Distance 7 from answer 62.

\$\endgroup\$
4
  • \$\begingroup\$ I'm not quite convinced whether this is valid, as the OP said you can use another output format if the language doesn't have stdout. Technically, there's \typeout in TeX (no pun intended). \$\endgroup\$ Oct 29, 2014 at 13:19
  • \$\begingroup\$ Anyway, it's probably too late now, not worth breaking the chain. \$\endgroup\$ Oct 29, 2014 at 13:24
  • \$\begingroup\$ @nyuszika7h: At least my version of TeX (3.1415926 (TeX Live 2014/dev)) doesn't seem to have \typeout. It works in LaTeX, which came with the same package. \$\endgroup\$
    – Dennis
    Oct 29, 2014 at 13:31
  • \$\begingroup\$ It might be LaTeX-specific then, I didn't know. \$\endgroup\$ Oct 29, 2014 at 13:33
1
2
3 4 5
7

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.