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.logoralertin 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
- Nit - APL, Clipper, Falcon, MUMPS, FreeBASIC, csh, Dart
- Timmy - Lua, Lisp, Oz, Algoid, KTurtle, Alice, OCaml
6 Answers
- Stacey - VHDL, GNU Octave, M4, Logo, Microsoft Batch, Matlab
- Dennis - Dash, tcsh, TeX, ///, HQ9+-, Alore
5 Answers
4 Answers
- ypnypn - NetLogo, Mouse, Salmon, Maple
- resueman - Clojure, Emacs Lisp, Vimscript, VBScript
- Timtech - AutoLisp, Geom++, BogusForth, owl
3 Answers
- BrunoJ - CoffeeScript, F#, Betterave
2 Answers
- Mig - Extended BF Type III, TCL
- Calvin's Hobbies - Python, E
- Sp3000 - Racket, Pyth
- grc - Haskell, Turing
- es1024 - Nimrod, ksh
- FireFly - FALSE, mIRC script
- g-rocket - AppleScript, LiveCode
- Oriol - AMPL, PARI/GP
- nneonneo - Boo, Caché ObjectScript
Languages used so far:
- Python
- CJam
- PHP
- Pyth
- Perl
- Befunge 98
- Bash
- Nimrod
- Ruby
- GNU dc
- Golfscript
- Mathematica
- R
- Lua
- Sage
- Julia
- Scilab
- JavaScript
- VHDL
- HyperTalk
- Haskell
- LOLCODE
- APL
- M30W
- Stata
- TI-BASIC (NSpire)
- ActionScript 2
- J
- PowerShell
- K
- Visual FoxPro
- VBA
- Extended BF Type III
- Zsh
- Dash
- Clojure
- NetLogo
- Groovy
- CoffeeScript
- Clipper
- B.A.S.I.C.
- FALSE
- fish (shell)
- GNU Octave
- TCL
- E
- newLisp
- Lisp
- SMT-LIBv2
- Racket
- Batsh
- tcsh
- AppleScript
- Mouse
- Pixie
- F#
- Falcon
- Burlesque
- HTML
- SGML
- M4
- MUMPS
- TeX
- Forth
- Salmon
- Turing
- bc
- Betterave
- Scheme
- Emacs Lisp
- Logo
- AutoLISP
- ///
- Rebol
- Maple
- FreeBASIC
- Vimscript
- ksh
- Hack
- mIRC
- Batch
- Make
- Markdown
- sh
- GDB
- csh
- HQ9+-
- Postscript
- Matlab
- Oz
- CASIO BASIC
- VBScript
- QBasic
- Processing
- C
- Rust 0.13
- Dart
- Kaffeine
- Algoid
- AMPL
- Alore
- Forobj
- T-SQL
- LiveCode
- Euphoria
- SpeakEasy
- MediaWiki
- SmallBASIC
- REXX
- SQLite
- TPP
- Geom++
- SQL (postgres)
- itflabtijtslwi
- RegXy
- Opal.rb
- Squirrel
- Pawn
- Scala
- Rebmu
- Boo
- PARI/GP
- Red
- Swift
- BeanShell
- Vala
- Pike
- Suneido
- AWK
- Neko
- AngelScript
- gosu
- V
- ALAGUF
- BogusForth
- Flaming Thunder
- Caché ObjectScript
- owl
- Cardinal
- Parser
- Grin
- Kitten
- TwoDucks
- Asymptote
- CAT
- IDL
- Tiny
- WTFZOMFG
- Io
- MuPAD
- Java
- Onyx
- JBoss
- S+
- Hexish
- yash
- Improbable
- wake
- brat
- busybox built-in shell
- gammaplex
- KTurtle
- AGOL 68
- Alice
- SML/NJ
- OCaml
- CDuce
- Underload
- Simplex v.0.6
- Minkolang 0.9
- Fexl 7.0.3
- Jolf
- Vitsy
- Y
- Retina
- Codename Dragon
- Seriously
- Reng v.3.3
- Fuzzy Octo Guacamole
- 05AB1E
- Foo
- Vyxal
- Jyxal 0.5.1
- Uiua
- sed
(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.
-
61\$\begingroup\$ "Sort by oldest" is useful here. \$\endgroup\$xnor– xnor2014年10月27日 06:39:15 +00:00Commented Oct 27, 2014 at 6:39
-
8\$\begingroup\$ chatroom for discussion on this question \$\endgroup\$Justin– Justin2014年10月27日 07:04:19 +00:00Commented Oct 27, 2014 at 7:04
-
5\$\begingroup\$ @Mew HQ9+ prints the wrong message. But this one... esolangs.org/wiki/Huby \$\endgroup\$Sp3000– Sp30002014年10月27日 13:55:56 +00:00Commented 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.– Michael M.2014年10月27日 15:00:30 +00:00Commented Oct 27, 2014 at 15:00
-
6\$\begingroup\$ @gerrit Cause I could really use 350 more answer notifications... \$\endgroup\$Calvin's Hobbies– Calvin's Hobbies2014年11月04日 01:39:25 +00:00Commented Nov 4, 2014 at 1:39
186 Answers 186
-
1\$\begingroup\$ Which answer 15 have you used? \$\endgroup\$Beta Decay– Beta Decay2014年10月27日 09:21:39 +00:00Commented 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\$Martin Ender– Martin Ender2014年10月27日 09:22:17 +00:00Commented Oct 27, 2014 at 9:22
Answer 18 - JavaScript
alert("Hello World!");
Lev. Dist from A#17 = 5
-
\$\begingroup\$ awww, so close! you beat me by 15 secs :( \$\endgroup\$user4768– user47682014年10月27日 09:31:27 +00:00Commented Oct 27, 2014 at 9:31
-
\$\begingroup\$ @Stacey maybe.... \$\endgroup\$MAKZ– MAKZ2014年10月27日 09:32:22 +00:00Commented Oct 27, 2014 at 9:32
-
\$\begingroup\$ An alert window isn't
stdout...? \$\endgroup\$zamnuts– zamnuts2014年10月27日 18:59:44 +00:00Commented Oct 27, 2014 at 18:59 -
2\$\begingroup\$ @zamnuts It is commonly accepted on PPCG to use
alertin Javascript as it has no real stdout. \$\endgroup\$Ingo Bürk– Ingo Bürk2014年10月27日 19:01:46 +00:00Commented Oct 27, 2014 at 19:01 -
3\$\begingroup\$ @zamnuts
console.loghas 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– Ingo Bürk2014年10月27日 19:05:00 +00:00Commented Oct 27, 2014 at 19:05
Answer 25 - Stata
display "Hello World!"
Distance: 6 ([-> ", ]-> ", and addition of di and pl)
-
1\$\begingroup\$ the
Wmust be capitalized to print "Hello World!". \$\endgroup\$user32377– user323772014年10月27日 10:18:44 +00:00Commented Oct 27, 2014 at 10:18 -
1\$\begingroup\$ Well, now I know why I've never heard of M30W. +1 \$\endgroup\$Pharap– Pharap2014年10月28日 08:33:31 +00:00Commented Oct 28, 2014 at 8:33
Answer 27 - ActionScript 2
trace("Hello World!")
Distance: 7 (Disp -> trac = 4, +e( = 2, +) = 1 = 4+2+1 = 7)
From Answer 26
-
\$\begingroup\$ Why 2? This is ActionScript 1. \$\endgroup\$Pierre Arlaud– Pierre Arlaud2014年10月28日 08:58:10 +00:00Commented 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– user323772014年10月28日 09:02:24 +00:00Commented Oct 28, 2014 at 9:02
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
-
\$\begingroup\$ Love the use of the commenting \$\endgroup\$sydan– sydan2015年02月13日 11:51:27 +00:00Commented Feb 13, 2015 at 11:51
Answer 60 - SGML
Heck, if HTML counts…
<vsh o[.]c;cat;#&&alert" ">Hello World!</vsh>
Distance from Answer 59 : 7
-
\$\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– kernigh2014年11月21日 20:08:46 +00:00Commented 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– msh2102014年11月23日 00:08:37 +00:00Commented Nov 23, 2014 at 0:08
Answer 9- Ruby
puts "\x48ello World!"
Distance: 4
Answer 13 - R
#[puts];
cat("Hello World!")
Distance = 5
Answer 20 - HyperTalk
answer "Hello World!"
Distance: 7
Answer 31 - Visual FoxPro
*#]trac
? "Hello World!"
Distance: 3 from Answer 30
Not tested of course, but * begins a comment and ? "String" prints String.
-
\$\begingroup\$ How on earth have you ever come across and vFox? Well done/sorry :-)! \$\endgroup\$Ben– Ben2014年10月27日 22:20:44 +00:00Commented 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– Doorknob2014年10月27日 23:55:08 +00:00Commented Oct 27, 2014 at 23:55
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.
-
2\$\begingroup\$ I would've cleaned up some of the odd things like 'dnl<vsh' instead of the common comment characters. \$\endgroup\$agweber– agweber2014年10月28日 15:12:03 +00:00Commented Oct 28, 2014 at 15:12
-
\$\begingroup\$ @agweber why make things too easy? :P \$\endgroup\$resueman– resueman2014年10月28日 15:16:39 +00:00Commented 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– 116842014年10月31日 21:17:33 +00:00Commented Oct 31, 2014 at 21:17
Answer 96 - Rust 0.13
fn//[]([.]c;
main() {
print!("Hello World!");}
//#[;]#bye;dnl</>
Distance 6 from answer 95.
-
\$\begingroup\$ I was sluggishly monitoring this for "C" answer to finally appear in order to try Rusting it... \$\endgroup\$Vi.– Vi.2014年10月29日 21:08:17 +00:00Commented Oct 29, 2014 at 21:08
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.
-
1\$\begingroup\$ Note: The spaces after
main()is a tab (introduced for Makefile). I didn't change it. \$\endgroup\$jimmy23013– jimmy230132014年10月30日 06:47:56 +00:00Commented Oct 30, 2014 at 6:47 -
\$\begingroup\$ Someone should get rid of it ... \$\endgroup\$Optimizer– Optimizer2014年10月30日 09:49:37 +00:00Commented Oct 30, 2014 at 9:49
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.
-
1\$\begingroup\$ What happened to answer 120? \$\endgroup\$user10766– user107662014年10月31日 17:19:38 +00:00Commented 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\$HostileFork says dont trust SE– HostileFork says dont trust SE2014年10月31日 17:21:57 +00:00Commented Oct 31, 2014 at 17:21
-
\$\begingroup\$ OK, I thought that might be the problem. \$\endgroup\$user10766– user107662014年10月31日 17:25:16 +00:00Commented Oct 31, 2014 at 17:25
-
1\$\begingroup\$ I meant to complete it like Boo Yeah! \$\endgroup\$Optimizer– Optimizer2014年10月31日 17:43:06 +00:00Commented Oct 31, 2014 at 17:43
-
2\$\begingroup\$ Appropriate language given today's date. \$\endgroup\$Amory– Amory2014年10月31日 21:47:04 +00:00Commented Oct 31, 2014 at 21:47
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.
-
\$\begingroup\$ I count more than 5:
a = "is already 5, and then there is":and the newline transformed into a space. \$\endgroup\$plannapus– plannapus2014年10月27日 12:22:40 +00:00Commented Oct 27, 2014 at 12:22 -
\$\begingroup\$ You might want to dump the spaces, because right now it's 8. \$\endgroup\$Scimonster– Scimonster2014年10月27日 12:26:06 +00:00Commented Oct 27, 2014 at 12:26
-
\$\begingroup\$ Shoot. I forgot to remove the extra space and there is already another answer @Scimonster. \$\endgroup\$RubberDuck– RubberDuck2014年10月27日 12:27:34 +00:00Commented 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– Scimonster2014年10月27日 12:28:19 +00:00Commented 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– agtoever2014年10月28日 11:02:29 +00:00Commented Oct 28, 2014 at 11:02
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
-
\$\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– Dang Khoa2014年10月27日 23:47:44 +00:00Commented Oct 27, 2014 at 23:47
-
\$\begingroup\$ I haven't tried running it, but changing this to Scilab might fix it \$\endgroup\$Sp3000– Sp30002014年10月27日 23:58:25 +00:00Commented Oct 27, 2014 at 23:58
-
\$\begingroup\$ @DangKhoa Aww, that's too bad. But it's fixed now. \$\endgroup\$Calvin's Hobbies– Calvin's Hobbies2014年10月27日 23:59:02 +00:00Commented Oct 27, 2014 at 23:59
Answer 62 - MUMPS
;dnl<vsh o[.]c;cat;#&&alert" ">
w "Hello World!";dnl</vsh>
Distance: 6
Answer 88 - Postscript
%#[]([.]c;main()
/eco (Hello World!)=
%#[;]:;#bye;dnl</>
Distance: 6 insertions to answer 87.
Back to real programming languages.
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 3Standalone 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
Xto point to the function value of P before you override it, etc.) cost 1Parentheses 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 1Semicolon 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
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
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.
Answer 45 - TCL
#ah="*#[.>]trac";cat<<
#&&alert
puts "Hello World!";#\
Distance 7 from #44
;#\ is useless but I wanted to make the future answer more challenging.
-
1\$\begingroup\$ What's the point of the final comment? \$\endgroup\$Ypnypn– Ypnypn2014年10月27日 20:52:30 +00:00Commented Oct 27, 2014 at 20:52
-
1\$\begingroup\$ Absolutely useless ! \$\endgroup\$Michael M.– Michael M.2014年10月27日 20:54:12 +00:00Commented Oct 27, 2014 at 20:54
-
3\$\begingroup\$ It's only challenging for a language that doesn't use
#for comments ;) \$\endgroup\$user4768– user47682014年10月27日 20:55:12 +00:00Commented Oct 27, 2014 at 20:55 -
2\$\begingroup\$ I thought I can get
if 0 [puts "Hello World!"]at some point... to make it not only challenging but also confusing. \$\endgroup\$jimmy23013– jimmy230132014年10月27日 21:39:53 +00:00Commented Oct 27, 2014 at 21:39 -
7\$\begingroup\$ -1 for deliberately making future answerers' job harder. Some of us are trying to do the exact opposite, because that first line is really annoying. \$\endgroup\$user344– user3442014年10月27日 21:40:14 +00:00Commented Oct 27, 2014 at 21:40
Answer 48 - Lisp
;@echo o#[.>]trac";cat<<
;#&&alert
(princ "Hello World!");\
Distance = 7
-
5\$\begingroup\$ Is that supposed to be princ? \$\endgroup\$TRiG– TRiG2014年10月27日 23:09:43 +00:00Commented Oct 27, 2014 at 23:09
-
5\$\begingroup\$ @TRiG It's not a typo. stackoverflow.com/questions/19756296/… \$\endgroup\$Etheryte– Etheryte2014年10月27日 23:17:21 +00:00Commented 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– kernigh2014年11月21日 20:00:11 +00:00Commented Nov 21, 2014 at 20:00
-
4\$\begingroup\$ I just realized what this is starting to remind me of... \$\endgroup\$Calvin's Hobbies– Calvin's Hobbies2014年10月28日 01:40:27 +00:00Commented Oct 28, 2014 at 1:40
-
\$\begingroup\$ upvote for cat & mouse :) \$\endgroup\$CodeManX– CodeManX2014年11月05日 02:26:13 +00:00Commented Nov 5, 2014 at 2:26
Explore related questions
See similar questions with these tags.