71
7
About a year ago on Dec 31, 2015, I had the idea that:
Doorknob graciously collected characters from the PPCG community and kept them safe for a year.
A whopping 74 people participated so we have a spiffing 74 printable-ASCII characters to play with!
Here are the 74 characters of the 2016 time capsule string in the order they were submitted:
H@~*^)$.`~+1A|Q)p~`\Z!IQ~e:O.~@``#|9@)Tf\eT`=(!``|`~!y!`) Q~$x.4|m4~~&!L{%
Here are the 74 characters of the 2016 time capsule string in ASCII order (note leading space):
!!!!!#$$%&())))*+...1449:=@@@AHILOQQQTTZ\\^`````````eefmpxy{||||~~~~~~~~~
It's not a whole lot to work with, but round here we like a challenge.
The Challenge
To determine what language is "best" with the time capsule string we'll have 6 (for 2016) challenges that increase in difficulty where in each you must use a subset of the 74 time capsule characters.
Having 6 distinct challenges helps ensure more languages can compete, but only the best languages will be able to answer all of them and score high.
Scoring:
- Each challenge will be scored from 0 to 74 depending on how many characters are used.
- Higher scores are better.
- If your language cannot complete a challenge, your score for that challenge is 0.
- Any nonempty subset of the challenges may be completed.
- Your final score is the sum of scores from all 6 challenges.
- The best final score possible is 6×74 or 444.
The Challenges
1. Run
If a language's code can't run in the first place it won't be able to do anything at all.
Write the longest full program possible (using only the 74 time capsule characters, remember) that runs/executes without compile-time or runtime errors.
It doesn't matter what the program does, it doesn't matter if it has input/output or enters an infinite loop, it only matters that it runs without errors. (Warnings are ok, as are errors caused by bad user input.)
Comments are allowed, so this could be as simple as
#H@~*^)$.`~+1A|Q)p~`\Z!IQ~e:O.~@``|9@)Tf\eT`=(!``|`~!y!`) Q~$x.4|m4~~&!L{%
in Python for a score of 74.
(Don't be afraid to answer if this is the only challenge your language can complete, but don't expect lots of votes either.)
Score = program length (longer program is better)
2. I/O
A language that has no form of input or output is almost as useless as one that can't run.
Given a printable ASCII character from !
(0x33) to }
(0x7D) inclusive, output the printable ASCII character before and after it.
The output can be a length two string or list, or the characters separated by a space or newline.
For example if the input is }
the output might be |~
or ["|", "~"]
or | ~
or |\n~
.
Likewise, "
is the output for !
and AC
is the output for B
.
Score = 74 - program length (shorter program is better)
3. Branchability
Conditionals are often a requirement for Turing completeness, which is often a requirement for a language being useful.
Given a positive integer, if it ends in the decimal digits 16
then change the 6
to a 7
and output the result; otherwise, output the input unchanged. You may use strings for input/output if preferred.
Examples:
2016 -> 2017
16 -> 17
116 -> 117
1616 -> 1617
6 -> 6
15 -> 15
17 -> 17
106 -> 106
2106 -> 2106
Score = 74 - program length (shorter program is better)
4. Loopability
A language that can't do loops will spawn repetitive code so tedious you'll need to take a programming break for a while.
Given a positive integer, output an ASCII-art square of that side length filled with a pattern of concentric smaller squares that alternates between any two distinct printable ASCII characters. They don't have to be the same two characters for different inputs.
For example:
1 <- input
X <- output
2
XX
XX
3
XXX
X-X
XXX
4
XXXX
X--X
X--X
XXXX
5
YYYYY
Y...Y
Y.Y.Y
Y...Y
YYYYY
6
XXXXXX
X----X
X-XX-X
X-XX-X
X----X
XXXXXX
7
ZZZZZZZ
Z-----Z
Z-ZZZ-Z
Z-Z-Z-Z
Z-ZZZ-Z
Z-----Z
ZZZZZZZ
Score = 74 - program length (shorter program is better)
5. Math
A language that's not good with numbers and math may as well be for humanities majors.
Take no input but output the 72 integer divisors of 2016, positive and negative, in any order. The output can be formatted as a string or list in a reasonable way.
Example:
-1, -2, -3, -4, -6, -7, -8, -9, -12, -14, -16, -18, -21, -24, -28, -32, -36, -42, -48, -56, -63, -72, -84, -96, -112, -126, -144, -168, -224, -252, -288, -336, -504, -672, -1008, -2016, 1, 2, 3, 4, 6, 7, 8, 9, 12, 14, 16, 18, 21, 24, 28, 32, 36, 42, 48, 56, 63, 72, 84, 96, 112, 126, 144, 168, 224, 252, 288, 336, 504, 672, 1008, 2016
Score = 74 - program length (shorter program is better)
6. Esotericism
(No, not that.) We at PPCG like our esoteric stuff, and quines are a good example of that.
Write the longest quine you can, according to usual quine rules. A quine is a program that takes no input and outputs itself.
Score = program length (longer program is better)
Specific Rules
- In each of the 6 challenges your program must be a subset of the 74 time capsule characters rearranged any way you like. It may be an empty subset or an improper subset, so each of your programs could have as few as 0 and as many as 74 characters.
- A single trailing newline at the end of input/output/code is alright anywhere since some languages require this or it cannot be easily avoided.
- Unless otherwise specified, each challenge may be completed as a function or full program according to our defaults.
- All challenges must be completed in the same language.
- You must use a language (or version of a language) made before it was 2017 anywhere on Earth.
- Anyone is welcome to answer, whether you added a character to the time capsule or not.
Feel free to use the 2016 time capsule characters in your own challenges.
4Yay :D a challenge where JavaScript can potentially excel! – Downgoat – 2017-01-03T06:06:55.310
1Discussion chat room for collaborating on some solutions. – user48538 – 2017-01-03T09:06:47.027
6fairly sure that
6×74 or 444
is not possible, as that would mean empty programs, which somehow behave differently. hence, 442 is the actual minimum, as that means that two of the 3 input taking programs have a char in them – Destructible Lemon – 2017-01-03T09:14:56.353Is it OK if the characters for question 2 are output as their character codes? (I discovered an interpreter bug in the 7 interpreter that's causing character output to not work, but I can output integers just fine.) – None – 2017-01-03T09:42:54.410
For the second challenge, do they have to be in order? – FlipTack – 2017-01-03T09:58:50.987
@ais523 No, output the chars themselves. – Calvin's Hobbies – 2017-01-03T10:01:28.190
@FlipTack Yes. The lower one should come first. – Calvin's Hobbies – 2017-01-03T10:02:57.460
@HelkaHomba: OK, then, seems that PPCG's policy on interpreter bugs means it's not worth me trying to compete on this. – None – 2017-01-03T10:09:27.610
7My language is Java. I lose by default :P – Weckar E. – 2017-01-03T10:24:18.523
Suppose the task is to raise a number to the 4th power. Can I do the following? Write a script
Q^4
in the fileT
. In the command window you writeQ=3;T
. This will write81
to STDOUT. The input is to STDIN (allowed by default), but it's given before calling the script. – Stewie Griffin – 2017-01-03T11:41:13.303Is using Minecraft command blocks allowed? 'cause Minecraft gets to score 74 :) – RudolfJelin – 2017-01-03T19:43:19.210
@RudolfL.Jelínek I guess but you may have to stretch rules with byte counting. You can answer but since it might be kinda contrived I may not consider it when selecting a winner.
– Calvin's Hobbies – 2017-01-03T21:23:27.7872Let's do this again! – ev3commander – 2017-01-04T00:27:46.767
For challenge 1, is requiring user input allowed? As in a script that only works for certain types of user input. – isaacg – 2017-01-04T08:31:19.627
@isaacg Yes that's OK. – Calvin's Hobbies – 2017-01-04T08:33:56.490
@HelkaHomba Minecaft, as I said, could get to score 74 by
me H@~*^)$.\
~+1A|Q)p~`\Z!IQ~:O.~@``#|9@)Tf\eT`=(!``|`~!y!`)Q~$x.4|4~~&!L{%(note the space after
me), when run either in chat, or in a command block. The problem is, in chat it uses an extra
/` and with a command block it uses the block :) How would/could one count the score with this? Is it possible (allowed) to ignore the command block and just paste the code? – RudolfJelin – 2017-01-04T15:51:04.707damn, i just need one more
Q
... Next episode : count number of supplementary characters needed to implement a challenge (0 if no other characters than those in time capsule string). Lowest number of supplementary characters win. – aluriak – 2017-01-05T20:27:46.760@ev3commander: Are we collecting chars for next year? – Joshua – 2017-01-06T04:19:14.450
@joshua: I don't know.. – ev3commander – 2017-01-06T12:31:06.583
In other other code-golf challenges on this site, I've seen people submit Perl answers meant to be run like
perl -pe "ANSWER HERE"
, where thep
switch provides automatic input & output. They then count thep
as +1 bytes, but consider theperl -e ""
to be free. Is this allowed here, if the letterp
is taken from the 74 characters? (I see no other way to get I/O, and thus attempt challenges 2-6, with Perl or Perl 6.) – smls – 2017-01-24T18:10:40.497Are we allowed to interpret the ASCII characters as bytes? for example,
=e
would be3D 65
, which isSE vD,65
in Chip-8. If not, are there any other options? Using assembly wouldn't be fair since it's not standardized. – 12Me21 – 2017-10-06T17:07:14.190