Fault-Tolerant Hello World

Befunge, Score 0

I think I cracked it - no single character deletion will change the output.
Deleting any character from line 1 changes nothing - it still goes down at the same place.
Lines 2 and 3 are redundant. Normally line 2 is executed, but if you delete a character from it, the < is missed, and line 3 takes charge.
Deleting newlines doesn't break it either (it did break my previous version).
No test program, sorry.

EDIT: simplified a lot.

@,,,,,,,,,,,,,"Hello, world!"<<
@,,,,,,,,,,,,,"Hello, world!"<<

A short explanation of the flow:

  1. Befunge starts executing from top-left, moving right. Spaces do nothing.
  2. v turns the execution flow downward, so it goes down one line.
  3. < turns the execution flow left, so it reads line 2 in reversed order.
  4. "Hello, world!" pushes the string to the stack. It's pushed in reversed order, because we're executing right to left.
  5. , pops a character and prints it. The last character pushed is printed first, which reverses the string once more.
  6. @ terminates the program.

Perl, Score 0

(147 characters)

Here is my solution, which I managed to get from 4 down to 0:

eval +qq(;\$_="Hello, world!";;*a=print()if length==13or!m/./#)||
+eval +qq(;\$_="Hello, world!";;print()if*a!~/1/||!m/./#)##)||
print"Hello, world!"

It must appear all on one line to work; line breaks are for "readability" only.

It benefits from Perl's pathologically permissive syntax. Some highlights:

  • Barewords that are not recognized are treated as strings. So when eval becomes evl, that is not an error if a string is permissible at that point.
  • Unary + operator, which does nothing other than disambiguate syntax in certain situations. This is useful with the above, because function +argument (where + is unary) becomes string + argument (addition) when a function name is mangled and becomes a string.
  • Many ways to declare strings: a double quoted string qq( ) can become a single-quoted string q(); a string delimited by parentheses qq(; ... ) can become a string delimited by a semicolon qq; ... ;. # inside strings can eliminate balancing issues by converting things to comments.

The length of this can probably be reduced somewhat, though I doubt ugoren's solution can be beaten.


This will never fail to produce the intended result when a character is deleted so gets a score of zero.


When do I start?