73
\$\begingroup\$

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.

\$\endgroup\$
21
  • 4
    \$\begingroup\$ Yay :D a challenge where JavaScript can potentially excel! \$\endgroup\$
    – Downgoat
    Commented Jan 3, 2017 at 6:06
  • 1
    \$\begingroup\$ Discussion chat room for collaborating on some solutions. \$\endgroup\$
    – user48538
    Commented Jan 3, 2017 at 9:06
  • 6
    \$\begingroup\$ fairly 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 \$\endgroup\$ Commented Jan 3, 2017 at 9:14
  • 7
    \$\begingroup\$ My language is Java. I lose by default :P \$\endgroup\$
    – Weckar E.
    Commented Jan 3, 2017 at 10:24
  • 2
    \$\begingroup\$ Let's do this again! \$\endgroup\$
    – user46167
    Commented Jan 4, 2017 at 0:27

29 Answers 29

38
\$\begingroup\$

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.
\$\endgroup\$
24
\$\begingroup\$

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?)

\$\endgroup\$
1
  • \$\begingroup\$ For #2, you can use 9`)ZH*+~):Q(Q). \$\endgroup\$
    – Dennis
    Commented Jan 4, 2017 at 4:38
11
\$\begingroup\$

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.

\$\endgroup\$
9
  • \$\begingroup\$ 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... \$\endgroup\$
    – Zgarb
    Commented Jan 4, 2017 at 8:55
  • \$\begingroup\$ Also, task 3 can be done without string functions: +16=100&|. You just need to produce 16 and 100 somehow. \$\endgroup\$
    – Zgarb
    Commented Jan 4, 2017 at 11:51
  • \$\begingroup\$ @Zgarb (1) Yeah... (2) Oh! That's cool! Hmmm shouldn't be too hard \$\endgroup\$ Commented Jan 4, 2017 at 11:58
  • \$\begingroup\$ Ha, I think I got 3: +($@#~@$~4)=1e4|&%:*~ It was extremely annoying because we only have one each of (&=:+* and two 4s. \$\endgroup\$
    – Zgarb
    Commented Jan 4, 2017 at 12:39
  • \$\begingroup\$ 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. \$\endgroup\$
    – Zgarb
    Commented Jan 4, 2017 at 13:13
8
\$\begingroup\$

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!

\$\endgroup\$
2
  • \$\begingroup\$ 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. \$\endgroup\$ Commented Jan 3, 2017 at 16:32
  • \$\begingroup\$ @TimmyD yeah, $^ is blank in a new session anyway. \$\endgroup\$
    – briantist
    Commented Jan 3, 2017 at 16:34
8
\$\begingroup\$

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.

\$\endgroup\$
8
\$\begingroup\$

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.

\$\endgroup\$
1
  • 3
    \$\begingroup\$ It actually does produce output. It produces those characters. They may not be "printable" (read: visible), but they are still sent to stdout nonetheless. \$\endgroup\$
    – mbomb007
    Commented Jan 4, 2017 at 14:45
7
\$\begingroup\$

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:

)))\\`````{~
\$\endgroup\$
6
\$\begingroup\$

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.

\$\endgroup\$
6
\$\begingroup\$

*><>, 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).

\$\endgroup\$
5
\$\begingroup\$

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.

\$\endgroup\$
0
5
\$\begingroup\$

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!

\$\endgroup\$
3
\$\begingroup\$

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.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Same for Python \$\endgroup\$
    – Daniel
    Commented Jan 3, 2017 at 7:54
3
\$\begingroup\$

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.

\$\endgroup\$
7
  • \$\begingroup\$ That quine is valid. \$\endgroup\$
    – wizzwizz4
    Commented Jan 3, 2017 at 11:47
  • 3
    \$\begingroup\$ 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 \$\endgroup\$ Commented Jan 3, 2017 at 11:58
  • \$\begingroup\$ @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. \$\endgroup\$
    – wizzwizz4
    Commented Jan 3, 2017 at 12:28
  • 1
    \$\begingroup\$ @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. \$\endgroup\$ Commented Jan 3, 2017 at 12:30
  • 1
    \$\begingroup\$ @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. \$\endgroup\$ Commented Jan 3, 2017 at 13:16
3
\$\begingroup\$

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.

\$\endgroup\$
3
\$\begingroup\$

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.

\$\endgroup\$
2
\$\begingroup\$

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.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ The quine program will (hopefully) be quite simple, if you can make some ops into noops. \$\endgroup\$
    – wizzwizz4
    Commented Jan 3, 2017 at 11:45
  • 1
    \$\begingroup\$ The 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. \$\endgroup\$
    – user45941
    Commented Jan 3, 2017 at 23:16
  • \$\begingroup\$ And there doesn't seem to be the italic f... :( \$\endgroup\$
    – user48538
    Commented Jan 4, 2017 at 5:27
2
\$\begingroup\$

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!

\$\endgroup\$
2
\$\begingroup\$

(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

\$\endgroup\$
5
  • 9
    \$\begingroup\$ 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. \$\endgroup\$
    – Riker
    Commented Jan 3, 2017 at 14:39
  • \$\begingroup\$ @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. \$\endgroup\$
    – Christoph
    Commented Jan 3, 2017 at 14:52
  • 4
    \$\begingroup\$ @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. \$\endgroup\$ Commented Jan 3, 2017 at 16:43
  • \$\begingroup\$ @MartinEnder: #!/bin/cat was considered a quine earlier. \$\endgroup\$
    – Joshua
    Commented Jan 4, 2017 at 20:53
  • \$\begingroup\$ @Joshua indeed, but these days it's not and neither is cat considered a programming language. \$\endgroup\$ Commented Jan 4, 2017 at 21:36
2
\$\begingroup\$

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.

\$\endgroup\$
2
\$\begingroup\$

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.

\$\endgroup\$
2
\$\begingroup\$

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.

\$\endgroup\$
1
  • \$\begingroup\$ +1 truly beautiful. I was wondering how I would do any of these and could never get it. What does this even do? \$\endgroup\$
    – snail_
    Commented Jan 24, 2017 at 12:05
1
\$\begingroup\$

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!

\$\endgroup\$
1
\$\begingroup\$

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.

\$\endgroup\$
1
  • \$\begingroup\$ 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. \$\endgroup\$
    – Joshua
    Commented Jan 5, 2017 at 2:50
1
\$\begingroup\$

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.

\$\endgroup\$
1
  • \$\begingroup\$ Nicely done, really! :) \$\endgroup\$
    – Dada
    Commented Mar 28, 2017 at 10:01
1
\$\begingroup\$

Vyxal, score 74

Run, 74 bytes

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

Try it Online!

The rest aren't easily possible.

\$\endgroup\$
1
\$\begingroup\$

abcn, score 65

The Challenges :

RUN : (73 bytes)

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

How it works :

Every thing other than @ (which is for input) is not present in current version of abcn. Note : abcn treats everything save its commands as simple comments so all of it is one big comment the three @ since we give no output are automatically set to 0.

I can obviously increase the length infinitely by doing nothing but bull but wont do it. (Alternate program down below) (scrapped it since I was 130 bytes in and not even 1/4th of the way done)

I/O : (8 bytes)

@agxbbgx

How it works :

@                                 --> asks for input
a                                 --> adds one
g                                 --> converts to ASCII
x                                 --> prints
bb                                --> b takes back to input second takes back by 1 more so we at input - 1
gx                                --> converts to ASCII and prints

Don't think can do remaining now.

Total score : 73 - 8 => 65

\$\endgroup\$
1
  • \$\begingroup\$ a, g, b and x aren't in the string. \$\endgroup\$
    – emanresu A
    Commented Aug 19, 2023 at 11:08
0
\$\begingroup\$

Lua, score 31

1. Run (31 of 74 points)

AHILOQQQTTZeefmpxy=1.%4+(4.*9.)
\$\endgroup\$
1
  • 3
    \$\begingroup\$ You missed the space. variable =stuff is 1 byte longer. \$\endgroup\$
    – devRicher
    Commented Jan 5, 2017 at 16:13
0
\$\begingroup\$

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.

\$\endgroup\$
0
\$\begingroup\$

///, 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.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.