74
6
Scenario
One of your friends is struggling on a homework assignment. He needs a simple program which prints the first 404 natural numbers:
1 2 3 4 5 6 7 8 9 10 11 ... 401 402 403 404
Your challenge is simple: write this program for him.
However, your connection is terrible, so 1 random character is lost every time you send the program. To prevent this from breaking your program, you must make it so that removing any single character will have no effect: the program works, regardless. (The original program must also work.)
Because the connection is too poor to send large files, your code must be as short as possible.
TL:DR - make a radiation hardened program to output the numbers 1 to 404
Rules/Details
- The output may be a list of integers in any reasonable format (separated by spaces, newlines, commas, etc). However, your output must be consistent and not change when the program is modified.
- Command line flags that contain logic, execute actual code, generate the number list, and so on, are banned.
- This is code-golf, so the shortest submission (in bytes) wins!
1Related. – Martin Ender – 2016-12-13T21:19:22.397
2Related – FlipTack – 2016-12-13T21:30:20.387
2Are command-line flags subject to radiation (e.g. Perl's
-p
flag)? – Gabriel Benamy – 2016-12-13T21:38:29.37316Does the original program (without any characters removed) also need to work? – Adnan – 2016-12-13T21:43:23.913
@Adnan “removing any single character will have no effect” sounds like the one-character-removed programs should do the same thing as the original program, so yes, I’d say – Lynn – 2016-12-13T22:01:23.830
2@Adnan Yes, the original program also needs to work - I'll make that clear in the spec :) – FlipTack – 2016-12-13T22:04:19.860
The -p flag wraps the program in
while(<>){ ... ; print$_}
. Does that count as logic? – Gabriel Benamy – 2016-12-13T22:06:29.773@GabrielBenamy I'd say it does, sorry – FlipTack – 2016-12-13T22:28:27.770
5Can errors be ignored if the program still prints 1 - 404? – jrich – 2016-12-13T23:17:17.243
@jrich yep, stray error output is allowed by default :) – FlipTack – 2016-12-14T05:45:45.960
4Maybe there should be a tag like [tag:radiation-hardering]? – Vi. – 2016-12-14T18:10:26.150
5Voting to close, we are not doing your homework for you XD – チーズパン – 2016-12-16T09:05:50.780
@ケセブロト crap, you got me. – FlipTack – 2016-12-16T19:39:35.710