2016 Time Capsule String: How Versatile Is Your Language?

71

7

About a year ago on Dec 31, 2015, I had the idea that:

We should make a time capsule string. Everybody gets to add one character and next new years we'll see who can make the best program out of all the characters with the esolangs that exist then.

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.

Calvin's Hobbies

Posted 2017-01-03T05:18:33.337

Reputation: 84 000

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.353

Is 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 file T. In the command window you write Q=3;T. This will write 81 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.303

Is 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.787

2Let'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 afterme), 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.707

damn, 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 the p switch provides automatic input & output. They then count the p as +1 bytes, but consider the perl -e "" to be free. Is this allowed here, if the letter p 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.497

Are we allowed to interpret the ASCII characters as bytes? for example, =e would be 3D 65, which is SE 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

Answers

37

Glypho, 74 + (74 - 36) = 112

1. Run (74 bytes)

!!#%QTQT@=A@$!!$)()*!&))+...1449:@HILOQZ\\^`````````eefmpx|||{~~~~~~y~|~ ~

2. IO (36 bytes)

!!!#!$!$4419TAHT\ee\OQQQ))*+)..)|~~~

Explanation

Glypho seemed like a fairly good choice for this challenge, because it doesn't care about the actual characters being used. Instead, it looks at groups of four characters and chooses the command based on the pattern of repetition in those four characters. Since there are a lot of duplicates among the time capsule string, we're fairly flexible in the programs we can write, except that we're limited to programs of 18 commands (which isn't a whole lot in Glypho). While this allowed me to solve the first two problems quite easily, I doubt that Glypho can run the others with so few characters.

I've tested these using the Java interpreter retrieved from 2006-06-23 on the wayback machine, which uses a slightly different mapping of the commands:

0000 n
0001 i
0010 >
0011 \
0012 1
0100 <
0101 d
0102 [
0110 +
0111 o
0112 *
0120 -
0121 ]
0122 !
0123 e

The Run program translates to:

1d-+[...]

Where ... is some junk that I didn't bother translating.

1      Push 1.
d      Duplicate.
-      Turn into -1.
+      Add. Gives 0.
[...]  Skip the rest because the top of the stack is zero.

The IO program translates to:

id1-+o1+o

Here is what this does:

i   Read a character.
d   Duplicate.
1   Push 1.
-   Turn into -1.
+   Add to character, i.e. decrement it.
o   Output it.
1   Push another 1.
+   Add to character, i.e. increment it.
o   Output it.

Martin Ender

Posted 2017-01-03T05:18:33.337

Reputation: 184 808

24

CJam, 74 + (74 − 14) + (74 − 26) = 182 score

1. Run (74 bytes)

e# !!!!!$$%&())))*+...1449:=@@@AHILOQQQTTZ\\^`````````efmpxy{||||~~~~~~~~~

Moving e# to the front comments out the entire line.

2. I/O (14 bytes)

9`)ZH*+~):Q(Q)

Dennis saved 8 bytes.

Explanation:

9`                   Push "9".
  )                  Extract character '9'.
   ZH*               Push 3 * 17 = 51.
      +              Add to get character 'l'.
       ~             Eval as CJam code. Command l reads a line.
        )            Extract the only character from the input line
         :Q(         Assign to Q and decrement
            Q)       Push Q and increment

3. Branchability (26 bytes)

4`)4Z|`I!`|~^~~T$AT$*%H(=+

Explanation:

4`)                            Push character '4'
   4Z|`                        Push 4 | 3 = 7, stringify
       I!`                     Push !18 = 0, stringify
          |~                   Setwise or and eval to get 70
            ^                  XOR to get 'r'
             ~                 Eval to read input
              ~                Eval the input as CJam code to turn
                               it into an integer
               T$              Duplicate it
                 A             Push 10
                  T$*          Duplicate that and multiply → 100
                     %         Mod the copy by 100
                      H(=      Compare to 17 - 1 = 16
                         +     Add the result (1 or 0) to the original

I’ll look at the others later. (EDIT: I doubt they’re possible, without block or string literals… maybe the math one?)

Lynn

Posted 2017-01-03T05:18:33.337

Reputation: 55 648

For #2, you can use 9`)ZH*+~):Q(Q). – Dennis – 2017-01-04T04:38:40.897

11

J, score 71 + (74 - 19) = 126

Task 1, length 71

AHILO=:( |T`T`Z`e`e`f`m`p`x`y|.~~%~@{|~^|Q@Q@Q+.*.449!~!~!~!!#$$&1\\~~)

This defines a verb AHILO to be the inside. Unused:

)))

I don't think there's any way to get longer than this.

Task 3, length 19

+($#~$~4)=1e4|&%:*~

The way to do this task with no restrictions is +16=100|], which reads as follows:

        ]  Input
    100|   mod 100
 16=       equals 16? (Evaluates to 1 or 0)
+          Add to input.

We have +, = and several copies or | in our disposal, and it's easy to get around ], but the numbers are more problematic. Here's the first part that computes input modulo 100:

1e4|&%:*~
       *~  Input squared (multiplied with itself).
1e4        The number 10000.
   |       Perform modulo
    &      on
     %:    their square roots.

After we're done with that, let's produce the number 16. The easy way is with *~4 (4 multiplied with itself), but we already used * so that's forbidden. Instead, we'll do some array manipulation.

($#~$~4)
    $~4   Reshape 4 to shape 4, resulting in the array 4 4 4 4.
  #~      Replicate wrt itself: replace each 4 by four 4s.
 $        Take length.

Work

2

This is most definitely impossible. The only ways to manipulate character values are a. and u:, and we have access to neither.

Now, if we could use a instead of, say, A, then this would be a solution:

Q{~(*^.4%9 1)+I.~&Q=:a.

The hardest part to getting this to work was producing the number -1.

Q{~(*^.4%9 1)+I.~&Q=:a.
                     a.  The array of all bytes.
                  Q=:    Bind it to Q
              I.~&       and find the input's index in it.
   (        )+           Add the following array:
    *                    Signum of
     ^.                  logarithm of
       4%                4 divided by
         9 1             the array 9 1.
                         This evaluates to -1 1.
Q{~                      Index back into Q.

4

(*.1:"|~@+.)

This generates the shape of the husk, but I can't seem to find a way to generate characters. Alas.

5

Admittedly, this seems like the easiest of the tasks to do in J. However, without i., this will be quite hard.

6

This is likely impossible without a fake-out quine like 449 or something like that, because the capsule string doesn't contain quotes or any other way of producing J strings.

Conor O'Brien

Posted 2017-01-03T05:18:33.337

Reputation: 36 228

For task 2, Q{~1+I.~&Q=:a. gives the next character: bind the alphabet a. to Q, find the input's index in it with I., add one, and index into Q. Try it. The only remaining problem is to produce -1...

– Zgarb – 2017-01-04T08:55:20.117

Also, task 3 can be done without string functions: +16=100&|. You just need to produce 16 and 100 somehow. – Zgarb – 2017-01-04T11:51:01.963

@Zgarb (1) Yeah... (2) Oh! That's cool! Hmmm shouldn't be too hard – Conor O'Brien – 2017-01-04T11:58:57.750

Ha, I think I got 3: +($@#~@$~4)=1e4|&%:*~ It was extremely annoying because we only have one each of (&=:+* and two 4s. – Zgarb – 2017-01-04T12:39:06.993

Aaand here's 2: Q{~(*^.4%9 1)+I.~&Q=:a. I realized that the logarithm ^. gives negative numbers for inputs strictly between 0 and 1, and we have % for producing fractions and * for taking the results to -1 and 1. – Zgarb – 2017-01-04T13:13:51.727

Oh dang, 2 doesn't work because we have A and not a. I suppose it might be impossible then. – Zgarb – 2017-01-04T14:05:16.100

@Zgarb Darn. I thought it was lowercase, too. And nice on 3! I totally forgot about exponential notation. Also, couldn't +(*:4)=1e4&| work? I can't test it right now, as I don't have access to an interpreter. – Conor O'Brien – 2017-01-04T15:51:07.357

It doesn't work, because 1e4 is 10000, not 100. – Zgarb – 2017-01-04T17:42:16.483

@Zgarb Oops, haha. Fixing. – Conor O'Brien – 2017-01-04T17:59:15.183

8

PowerShell - Total Score: 74

1. Run - Score: 74

#~= `TeQ.)`~H|$QL4yA)\*`!^O$1)!Z`!`~|\`&T@!x+e(f|Q`.|!4%.{~`:~~)m@~`@p~I9~

Since this is extremely difficult in PowerShell (every possible method of obtaining input is impossible with the characters given, as far as I can tell), I've at least decided to randomize the first challenge so we're not all copying the example directly from the post.

So here's a random challenge 1 answer generator (for languages where # is a comment):

'#'+$(-join([char[]]' !!!!!$$%&())))*+...1449:=@@@AHILOQQQTTZ\\^`````````eefmpxy{||||~~~~~~~~~'|Get-Random -Count 73))

Try it online!

briantist

Posted 2017-01-03T05:18:33.337

Reputation: 3 110

I think you're correct. The closest we could get would be $^ which is "the first token of the previous line in the session," which would be extremely limited and very likely a severe bending of standard I/O rules. – AdmBorkBork – 2017-01-03T16:32:47.633

@TimmyD yeah, $^ is blank in a new session anyway. – briantist – 2017-01-03T16:34:40.550

8

Brainfuck, 74 bytes

H@~*^)$.`~+1A|Q)p~`\Z!IQ~e:O.~@``#|9@)Tf\eT`=(!``|`~!y!`) Q~$x.4|m4~~&!L{%

I just had to.

Explanation:

Any character that is not a valid Brainfuck character is treated as a comment. The only code that actually gets run is this:

.+..

This produces no printable output, since neither 0 nor 1 are printable characters in ASCII. However, it does not cause an error, so we successfully complete the first challenge.

Julian Lachniet

Posted 2017-01-03T05:18:33.337

Reputation: 3 216

3It actually does produce output. It produces those characters. They may not be "printable" (read: visible), but they are still sent to stdout nonetheless. – mbomb007 – 2017-01-04T14:45:56.130

8

memes, score of (62 65 + 70) 135

1: Run

I removed all backticks (`) and mathematical operators. They conflicted because there weren't enough numbers to satisfy every unary and binary operator. I left some in, resulting in +3 bytes. Resulting program:

 !!!!!#$$%&())))...+1^4*49:=@@@AHILOQQQTTZ\\eefmpxy{||||~~~~~~~~~

I have no idea why and how this worked. Atleast it doesn't throw any C# runtime exception, and doesn't therefore crash.

6: Quine

You know, if there would've been an - or lowercase q somewhere in those 74 characters, this would be way too easy. I'm glad for the I operator, atleast.

1/4I

This code isn't exactly obvious. Here's an explanation:

1    Set object to 1 (1)
/4   Divide by 4     (0.25)
I    Set object to a fraction string. (1/4)

Fraction strings (e.g. 1/4) are displayed with an I at the end, to indicate exactly that. The I operator is usually useless, I added it for other means, but hey, it works like this!

Above code is invalid. Stupid me didn't see that the 74 characters don't contain a single division operator, forwardslash (/). I came up with something else though:

True

Explanation:

T    Set object to "true" (bool value)
rue  None of these are valid tokens, so they don't get interpreted.

Outputs True (because of how the way C# handles Boolean.ToString() uppercase and not lowercase). Not sure if this is a proper quine, meanwhile I'm still cracking my head for a valid, really proper, and intuitive one.

Could maybe also solve I/O and Math challenge, but I'm missing specific tokens (characters) which aren't included in the 74 characters.

devRicher

Posted 2017-01-03T05:18:33.337

Reputation: 1 609

7

Mathematica, score of 62

I'd be surprised if anyone can make challenges 2-6 work in Mathematica. Here's the best I did with challenge 1:

A:=1.`!#&@(4`+4.`*9.`^$$H~I~L~O~Q~Q~Q~T~T||Z||e@@efmpxy%)!!!!

Defines a pretty stupid function A with a constant value. The 12 unused characters are:

)))\\`````{~

Greg Martin

Posted 2017-01-03T05:18:33.337

Reputation: 13 940

6

Octave, score 74

1. Run

x =@(AHILOQQQTTZeefmpy)+.1||!!!!!~~~~~~~~~4.^.4||9%#$$)))*@@\`````````{\&:

50 of these characters are part of the function, while the remaining 24 are not.

What it does:

x =@(AHILOQQQTTZeefmpy) creates a function x that can take a variable AHILOQQQTTZeefmpy as input.

To understand the rest:

a||b calls the function all() on both a and b. If one or both of those return true, the || operator will return true.

!a and ~a means the same thing here, they are both not(a).

a.^b is an element-wise power (a(1)^b(1), a(2)^b(2) ...)

Continued explanation

I'll shorten each of the steps as I go along:

4.^.4||9  % This is 4 raised to the power of .4||9
          % .4||9 is true, since both .4 and 9 are true
          % true is evaluated to 1 when used in an expression
...       % 4 raised to the power of 1 is simply 4.
4         % The above expression simplified

And:

!!!!!~~~~~~~~~4  % ! and ~ are the not() operator, so this is equivalent to:
not(not(not(not(not(not(not(not(not(not(not(not(not(not(4))))))))))))))

There is an even number of not, so this is equivalent to not(not(4)) which is true or 1.

+.1||1      % This is equivalent to all(+.1) | all(1), which returns true

The rest is commented out.

Stewie Griffin

Posted 2017-01-03T05:18:33.337

Reputation: 43 471

6

*><>, total score = 74

1. Run, score 74

f:4%*e+e14=p!Q H@~^)$.`~A|Q)~`\ZI~O.~@``#|9@)T\T`(!``|`~!y!`)Q~$x.|m~~&!L{

Try it here!

This was extremely hard to do without the ; character. I actually thought it was going to be impossible for a couple moments, until I saw the %, I had basically given up.

This is also a valid ><> program.

Explained (irrelevant parts omitted)

f:4%*e+e14=p!Q 

f:               copy 15
  4%             pop 15, push 15%4 (3)
    *            pop 15 and 3, push 15*3 (45)
     e+          pop 45, push 45+14 (59, ascii ";")
       e         push 14
        14=      push 0
           p     replace coord (14, 0) with ";"
            !Q   skip Q (this is just filler)
              ;  end execution

Challenges faced

I might try the other challenges ... they'd be extremely hard and may involve bending the rules in weird ways but liberal use of the | mirrors and the ! trampolines should make at least one more challenge possible.

These challenges are particularly hard because we're not allowed any outputs with *><> (o and n), or even function calls (C), function returns (R), or program terminators (;). Even though we're also missing i for input, we can still have input placed on the stack which is a plus. Another plus is that we get a single p instruction, which allows us to replace an instruction in the codebox. This might be able to be used multiple times (haven't figured out a practical way yet), which would start to make the other programs seem more possible (as we'd be able to generate two or more instructions).

redstarcoder

Posted 2017-01-03T05:18:33.337

Reputation: 1 771

5

Haskell, score 63

1. Run:

(!!!!!#$$%&*+...:@@@\\^||||~~~~~~~~~)fmpxyAHILOQQQTTZ e=14`e`49

Not used are )))```````{. Comments in Haskell are -- or {- ... -}, so there is no easy all-comment version.

This code defines an infix operator !!!!!#$$%&*+...:@@@\^||||~~~~~~~~~ which takes two arguments:

  1. fmpxyAHILOQQQTTZ which is ignored and can therefore be of an arbitrary type
  2. e, which must be a function taking two numbers

In the function body e is then applied to 14 and 49, using the `-infix notation.

Usage example:

Prelude> () !!!!!#$$%&*+...:@@@\\^||||~~~~~~~~~ (*)
686

The operator is applied to (), the empty tuple, and (*), the multiplication operator, so 14*49 = 686 is computed.

Try it online!

Other challenges

I doubt that any of the other challenges are possible, most notably because of the lack of possible variable names that can appear twice, which is only e (or something like eQT), because variable names can't start with an uppercase letter. Of course, having only one = doesn't help either.

Laikoni

Posted 2017-01-03T05:18:33.337

Reputation: 23 676

5

Pyth, 131 for now (2 challenges complete)

1. Run, 74

# `````````!!!)!)!)*$AOeIefLmpxQ|Q|y|Q|~~~~~~~~~()${+%&\=@@@^\:.1.4.49TTZH

This program takes no input and creates no output.

This program uses $$, which allows arbitrary code execution, and so is banned online, so this program online runs offline. Here's its compilation output, so you can see what actually gets run:

while True:
 try:
  (repr(repr(repr(repr(repr(repr(repr(repr(repr(Pnot(Pnot(Pnot()))))))))))))
  imp_print(Pnot())
  imp_print(Pnot())
  imp_print(times(AOeIefLmpxQ|Q|y|Q|~~~~~~~~~(),uniquify(plus(mod(("=" and lookup(lookup(lookup(Ppow(":",.1),.4),.49),T)),T),Z))))
  imp_print(H)
 except Exception:
  break

It's fairly tricky to write a program with arbitrary characters that doesn't error in Pyth. I set myself the additional challenge of requiring that the program run without requiring user input, as well.

The first step is to use # to eat all of the errors. Next, we need to avoid errors caused by ~, I and L, which each have their own details. This is achieved by putting them inside the $$, which embeds them inside the output compilation, and thus subjects them to Python's compilation rules, not Pyth's. Finally, to avoid taking user input, the various arity 0 tokens (Variables and similar) are placed at the end, and the Qs are moved inside the $$ block.

2. IO

This will be incredibly difficult, if it's even possible. None of the Pyth functions that create arbitrary strings or characters are present except .f, and that does a really poor job of creating arbitrary characters.

3. Branchability: 74 - 17 = 57

|&x%Q*TTye|LZ9Q+1

Try it online

An equivalent Pyth program would be:

?n%Q100 16Q+1

This code takes the input mod 100, compares it to 16, and then uses a ternary to choose between the input and the input plus one. Due to character restrictions, I made some substitutions:

  • Instead of ?, the ternary, I used |&, or then and, which has the same functionality, except that it breaks if the input is zero, but since we're guaranteed positive integer input, it's fine. (This could have been fixed for no additional characters, but it's simpler this way.)

  • Instead of directly comparing the two numbers, I take their XOR with x, which is zero if and only if they're equal, as desired.

  • Instead of writing 100 directly, I generate it with *TT, since T is initialized to 10.

  • Instead of writing 16 directly, I generate it with ye|LZ9. |LZ essentially functions as the range function, so |LZ9 gives [0, 1, 2, 3, 4, 5, 6, 7, 8]. e takes the final element of a list, giving 8. y doubles it, giving 16 as desired. With an extra + or an extra * I could save a character, but they're both more useful elsewhere.

More to come!

isaacg

Posted 2017-01-03T05:18:33.337

Reputation: 39 268

3

Ruby - Score: 74

1. Run

#H@~*^)$.`~+1A|Q)p~`\Z!IQ~e:O.~@``|9@)Tf\eT`=(!``|`~!y!`) Q~$x.4|m4~~&!L{%

Grabbed from the challenge.

dkudriavtsev

Posted 2017-01-03T05:18:33.337

Reputation: 5 781

1Same for Python – Daniel – 2017-01-03T07:54:55.467

3

JavaScript (ES6), score = 74

1. Run, 74 bytes

Z=` !!!!!#$$%())))...1449:@@@\AHILOQQQTT^\`eefmpxy{||||~~~~~~~~~`*``+``&``

6. Esotericism (invalid)

For the record, my suggested quine was:

1.4e+49

which turned out to be invalid, as discussed in the comments below.

Arnauld

Posted 2017-01-03T05:18:33.337

Reputation: 111 334

That quine is valid. – wizzwizz4 – 2017-01-03T11:47:40.520

3

The quine is not valid. The relevant rules are linked in the challenge. In particular, any quine that is based on a single literal fails to encode part of source in a different part of the source. cc @wizzwizz4

– Martin Ender – 2017-01-03T11:58:39.013

@MartinEnder In my browser, that program outputs its source code literally. It's a statement that evaluates to itself. I'm not sure what you're saying; there is no different part of the source. – wizzwizz4 – 2017-01-03T12:28:40.230

1@wizzwizz4 this community has more requirements for quines than just "the program prints its own source", because that allows for various kinds of cheating solutions that are not in the spirit of quines. See the link. – Martin Ender – 2017-01-03T12:30:33.627

@MartinEnder Thanks for the clarification. – Arnauld – 2017-01-03T12:44:33.160

@MartinEnder I read all three answers to that question, but there's nothing about statements. There is something about structure (as explained in the comment below), but there are many popular quines on Golf you a quine for great good, notably this one, that do not fit that structure and in fact use a similar technique to this one. (Although, the question does link to specific rules, and that overrules any general rules that there may be).

– wizzwizz4 – 2017-01-03T13:13:56.420

1@wizzwizz4 from the top voted answer "It must be possible to identify a section of the program which encodes a different part of the program. ("Different" meaning that the two parts appear in different positions.)" As for Golf you a quine for great good, the challenge (and the linked answer) are several years older than the linked meta post. – Martin Ender – 2017-01-03T13:16:39.060

3

Retina, score 74

1. Run, score 74

)))` !!!!!#$$%&()*.+..1449:=@@@AHILOQQQTTZ\\^````````eefmpxy{||||~~~~~~~~~

I moved the extra parens to the config in order for them to balance in the regex. I also moved the ` right after those, and changed +. to .+.

Try it online

The others are likely impossible, since there are no newlines. There's also no - for Transliteration or d for a digits character class.

mbomb007

Posted 2017-01-03T05:18:33.337

Reputation: 21 944

3

Pip, score 74 + (74 - 19) = 129

So many backticks with nary a quote to be seen, single or double!

Task 1, score 74

`` `\``!!!!!`#$$%&())))*+...1449:=@@@ILOQQQTTZ\^efmpx{|||~~~~~~~~~`|`yeAH`

Basically just a series of pattern (regex) literals in backticks, the last of which is printed. Since there are an odd number of backticks, we have to backslash-escape one of them (`\``). Try it online, with the -w flag added to prove that no warnings are generated.

Task 3, score 55 (length 19)

e+!!e%(1.#x.!9)=4*4

Using a rather odd input method--the fifth command-line argument--this is possible. Try it online!

                     e is 5th cmdline arg; x is empty string
       1.#x.!9       Concatenate 1, 0 (length of x), and 0 (not 9)
    e%(       )      e mod 100...
               =4*4  ... equals 16?
  !!                 Logically negate twice
e+                   Add to e (+1 if number mod 100 is 16, +0 otherwise)
                     Expression is autoprinted

Other tasks

It's possible to get input for task 2, by the same method as task 3 above. The trouble is converting to ASCII code and back to a character. The former can be done with A, but the latter requires C, or possibly indexing into the PA variable. Constructing and evaluating code can't be done without V. I don't think the task is possible.

Task 4 is challenging even without a restricted character set. At a guess, it would require lists (without using the [] delimiters or RL (repeat list) and only having one chance to use AL (append list)--not likely) or possibly something with CG (coordinate grid) or MC (map coords), both disallowed.

Task 5 is on the edge of possibility. Loops would be difficult, since For and Map aren't possible, and ranges can't be constructed with ,. There might be something to be done with Till. Increment could be of the x:x+1 variety (obviously with a variable other than x, though). Divisibility checks can use %. Still, I don't think there are enough characters--especially repeated letters--to do everything that needs to happen.

Task 6 looks completely impossible. All known Pip quines have " in them. They also use R (replace), RP (repr), or V (eval), none of which are available.

DLosc

Posted 2017-01-03T05:18:33.337

Reputation: 21 213

2

Actually, score (74 + 0 + 0 + 0 + 0 + 0) = 74

Yes, the capsule string will work with Actually as it is for Run, as Actually dismisses any errors and every error becomes a NOP.

H@~*^)$.~+1A|Q)p~\Z!IQ~e:O.~@#|9@)Tf\eT`=(!|~!y!) Q~$x.4|m4~~&!L{% (Try it online!)

It will output a mess of things, though (but also its source once :3).

I'll be working on other challenges, however.

user48538

Posted 2017-01-03T05:18:33.337

Reputation: 1 478

1The quine program will (hopefully) be quite simple, if you can make some ops into noops. – wizzwizz4 – 2017-01-03T11:45:45.270

1The quine program is not simple. You cannot use Q at all (since it's the quining builtin), and there's no double quotes, so you can't do any string formatting. I worked for a while on this yesterday, and I'm fairly certain the other programs are not possible solely with the 74 characters. – Mego – 2017-01-03T23:16:38.900

And there doesn't seem to be the italic f... :( – user48538 – 2017-01-04T05:27:48.550

2

05AB1E - Total score: 74

1. Run, 74 bytes

H@~*^)$.`~+1A|Q)p~`\Z!IQ~e:O.~@``#|9@)Tf\eT`=(!``|`~!y!`) Q~$x.4|m4~~&!L{%

Everything that causes an error is skipped by 05AB1E. This whole line of code is a NOP.

Try it online!

Adnan

Posted 2017-01-03T05:18:33.337

Reputation: 41 965

2

Mathematica, score 68

`A:= .1%*.44y#+.9^`H@`$I@`L@(`$O~`Q~`Q~`Q~`T~T~Z~e~e|f|m|p|x)!!!!!&\

Notice the trailing newline. I do not believe that any of the other challenges can be achieved with Mathematica.

LegionMammal978

Posted 2017-01-03T05:18:33.337

Reputation: 15 731

2

(abused) PHP, 74 + 74 = 148

H@~*^)$.`~+1A|Q)p~`\Z!IQ~e:O.~@``#|9@)Tf\eT`=(!``|`~!y!`) Q~$x.4|m4~~&!L{%

The PHP interpreter simply dumps the source code until it finds a <? since we lack < every permutation of those chars is a running quine. I guess this is not that worse than using a builtin quine command :P

Christoph

Posted 2017-01-03T05:18:33.337

Reputation: 1 489

9

This doesn't meet our specifications for quines, see here. It doesn't encode itself (i.e. it doesn't actually print itself, it just happens to be outputted because of the compiler.

– Rɪᴋᴇʀ – 2017-01-03T14:39:56.197

@Easterly the interpreter treats every char as output this char until it meets an <. I'm not saying it's payload-capable or sth I'm just saying that's no difference to a language having a char saying output the source. If this is not a valid answer for part 1 than any language that accepts any input without error is not valid answer, too. I don't think this is more abusive than most answers here. – Christoph – 2017-01-03T14:52:19.103

4@Christoph it's valid for part one, but it's not a valid quine by the rules linked in the challenge. This community considers a quine valid if you can identify a section of the source that encodes a different part of the code. In your program, every character only encodes itself. – Martin Ender – 2017-01-03T16:43:53.837

@MartinEnder: #!/bin/cat was considered a quine earlier. – Joshua – 2017-01-04T20:53:50.297

@Joshua indeed, but these days it's not and neither is cat considered a programming language. – Martin Ender – 2017-01-04T21:36:20.460

2

Labyrinth, score 74

AH)
IL)
OQ:
`=!)~`{+4.@ !!!$$%&(*..149@@TTZ\\^```eefmpxy||||~~~~~~~~
`Q#
`Q)
``!

I'm pretty sure any assortment of these characters produces a valid Labyrinth program, but to make it at least slightly more interesting, this prints out 2016 digit by digit. (In summary: push 2 2's on the stack, pop/print one, move the other to the aux stack, print 0, push 2 1's on the stack, pop/print 1, increment, bitwise not, negate (that last 1 is a 3 at this point), sum with the 2 from the aux stack, 5*10+4 = 54, print as ascii value, terminate)

Most of the long line is simply ignored, as the @ terminates the program.

Challenges 2, 3, and 4 are impossible since neither of Labyrinth's input commands are available (, or ?), and I didn't come up with anything for 5 or 6.

SnoringFrog

Posted 2017-01-03T05:18:33.337

Reputation: 1 709

2

SmileBASIC, 48 points

challenge 1:

@LOQQQTTZ A$=H$+@efmy+@9414*!exp(!!.||!!.#||I%):

explanation:

@LOQQTTZ 'label
A$= 'set value of A$ (string)
H$ 'string
+@efmy 'adds label, interpreted as string literal
+@9414 'adds label, interpreted as string literal
*!exp( 'multiplies by logical not e^x (= 0)
!!. 'not not 0.0 (= 0)
||!!.# 'or not not 0.0 converted to a float (= 0)
||I% 'or I% (integer variable)
: 'equivalent to a line break, does nothing here

others:

No input/output commands are avaliable, so the rest are not possible.

Still, not bad for a real language without using comments.

12Me21

Posted 2017-01-03T05:18:33.337

Reputation: 6 110

+1 truly beautiful. I was wondering how I would do any of these and could never get it. What does this even do? – snail_ – 2017-01-24T12:05:42.723

1

MATL, total score 74

1. Run, score 74

`4.e4 1.$!!!!!T+Zyf9.)AH^ILx@Q@Q@Qm||||~~~~~~~~~:=Tp*O%#$&()))\\````````e{

Everything up to % is actual code. % is a comment symbol, so the characters to its right are ignored.

The program outputs 1 without errors.

Try it online!

Luis Mendo

Posted 2017-01-03T05:18:33.337

Reputation: 87 464

1

bash, score 74

1: Run. We can run all 74

#H@~*^)$.`~+1A|Q)p~`\Z!IQ~e:O.~@``|9@)Tf\eT`=(!``|`~!y!`) Q~$x.4|m4~~&!L{%

6: Esotericism:

The empty program is a quine in bash.

Without any whitespace characters, nothing else on the list can be accomplished. Ergo, I have the winning bash entry.

Joshua

Posted 2017-01-03T05:18:33.337

Reputation: 3 043

Rule note: If somebody challenges that empty isn't a valid quine and wins, I still have the winning entry (w/o any quine). If on the other hand I don't place it and somebody else does and they win the challenge they beat me. So there it stays. – Joshua – 2017-01-05T02:50:44.430

1

Perl 6, total score 74

1. Run, score 74

my @TOTAL=$!||(e*4...9^e)Z+1~4||!!Q`{fp)))\#\&`~Q!```HI````!~Q:x~~~$~@~@~%

No comments.
(Just putting the # at the front to make everything a comment also works, but this is more fun.)

Work

This is the subset of the Perl 6 language that only uses the allowed characters:

Constants:   e

Type names:  IO

Functions:   exp

Methods:
    on type IO:   .e  .f  .x
    (...probably more.)

Operators:     |  infix:               |  prefix:
    -----------+-----------------------+---------
    numeric:   |  +  *  +^  +|  +&  %  |  +  +^
    string:    |  ~  x  ~^  ~|  ~&     |  ~
    boolean:   |  ||  ~~               |  !
    junctions: |  |  &  ^              |  
    misc:      |  =  :=  Z  ..  ...    |  

syntax:
    number literals:  1  4  9
    string literals:  Q` `  Q! !   etc.
    shell commands:   Q:x` `  Q:x! !   etc.
    Whatever star:    *
    variables:        my  \  $  @  &
    grouping:         (  )
    comments:         #  #`( )
    unspace:          \

The immediate hurdle preventing the challenges 2-6, is that there doesn't seem to be a way to do I/O:

  • If we assume there's a file called f, we could use Q`f`.IO.e to check if it exists or Q`f`.IO.x to check if it is executable. But we can't read it or write from it.

  • We could use Q:x` ` to run a shell command (assuming we find the characters for one). But we can't interpolate anything into, so it would only be good for reading, not writing.

  • Since there is no closing brace, we can't make a block lambda (e.g. {1 + $_}) that automatically returns the value of its last statement.

  • We could use the asterisk to make an expression lambda (e.g. 1+*), but then we can only take one argument, refer to this argument only once, and are even more limited in the syntax/operators we can use.

smls

Posted 2017-01-03T05:18:33.337

Reputation: 4 352

Nicely done, really! :) – Dada – 2017-03-28T10:01:18.083

0

Lua, score 31

1. Run (31 of 74 points)

AHILOQQQTTZeefmpxy=1.%4+(4.*9.)

Scribblemacher

Posted 2017-01-03T05:18:33.337

Reputation: 111

3You missed the space. variable =stuff is 1 byte longer. – devRicher – 2017-01-05T16:13:42.120

0

Jelly, score 74

1. Run, 74

 ||||!!!!!$$~~~~~~~~^@=@~%449:`e@`e`QAHILOQQTTZ{\\f`m`p`x`y`&`*.#1+.()))).

Not sure how to do any of the others.

Jonathan Allan

Posted 2017-01-03T05:18:33.337

Reputation: 67 804

0

///, Score: 146

1. Run, Score: 74

!!!!!#$$%&())))*+...1449:=@@@AHILOQQQTTZ\\^`````````eefmpxy{||||~~~~~~~~~

6. Quine, Score: 72

!!!!!#$$%&())))*+...1449:=@@@AHILOQQQTTZ^`````````eefmpxy{||||~~~~~~~~~

Yay, when there aren't any forward or back slashes in the code, it just prints itself.

Comrade SparklePony

Posted 2017-01-03T05:18:33.337

Reputation: 5 784