Générateur de code avec des caractères uniques

35

Défi

Votre tâche consiste à écrire un morceau de code qui en génère un autre. Ce code doit à son tour générer un autre code jusqu'à ce que le code final fournisse le nombre entier 1 . La chaîne se termine la première fois que 1 est sorti.

Aucun de vos programmes ne peut partager des caractères (il y a une exception dans la section Rules).

La soumission gagnante sera la soumission avec la plus longue chaîne. Le départage sera le code-longueur total le plus court.


Règles:

  • Vous pouvez utiliser les deux fonctions, programmes et extraits. Vous pouvez supposer un environnement REPL.
  • Toutes les fonctions doivent être écrites dans la même langue
  • Les langues indépendantes des symboles sont interdites. Ceci inclut des langages partiellement indépendants des symboles, tels que Headsecks.
  • Le formatage de sortie par défaut peut éventuellement être ignoré dans la sortie d'une fonction. Cela inclut les retours à la ligne, ans =etc.
  • Vous pouvez réutiliser le caractère espace (code de code ASCII 32), mais notez les points suivants:
    • Vous pouvez utiliser autant de caractères d'espacement que vous le souhaitez dans l'une des fonctions, mais limitez-le à un maximum de 5 dans toutes les autres fonctions.
    • Vous ne pouvez réutiliser aucun caractère si le code 32 n'est pas un espace dans votre langue.
  • Aucun des programmes ne peut prendre d’entrée

  • La chaîne doit avoir au moins deux programmes.


Exemple:

Votre code initial est abc+cab+bac. Cette sortie:, foofoo*123qui à son tour disp(~0), sortie 1. Ceci est une chaîne de 3 programmes, avec une longueur combinée de 29 (tie breaker).

Stewie Griffin
la source
Connexes
Jo King
1
Un peu lié
Kevin Cruijssen
Pour être sûr de bien comprendre: les programmes peuvent utiliser des commentaires, non? Je veux dire, des parties de code qui sont "inutiles"
Luis Mendo
2
Les expressions simples sont-elles autorisées? Par exemple, pourrait le dernier maillon d'un programme Python est 2^3, qui vient d' évaluer à 1, ou at - il par exemple être lambda:2^3, print(2^3)etc.?
nneonneo
3
Dans les langues où les littéraux peuvent être des programmes (comme dans beaucoup de langs de golf), peuvent 1être à la fois un programme et le résultat de ce programme ou la chaîne se termine-t-elle quand 1le résultat est-il?
Emigna

Réponses:

18

05AB1E , 5 chaînes: 236 + 29 + 13 + 3 + 1 = 282 octets

10101100011010001101100010110110001111000111001110101001000000000010111100100110011011010110011000100110101001001101100001110001111010100100000100010010001010011101011001110001000001011010101111001110011110001010111100001110110C₁<Au¦н.V

Essayez-le en ligne!

qui imprime le programme

633693S<J6bαð3<žQTÌ>è9663тαhJ

Essayez-le en ligne!

qui imprime le programme

522472 2-255B

Essayez-le en ligne!

qui imprime le programme

88ç

Essayez-le en ligne!

qui imprime le programme

X

Essayez-le en ligne!

qui imprime 1

Emigna
la source
8784>žxBet je suis probablement KO'd. Le manque de nombres pour la conversion de base est un craps total, sauf si vous le calculez. Si vous voulez battre emigna, l’objectif est d’utiliser le moins de nombres uniques par itération. Sa réponse règne en maître à cause des 88 dans l'avant-dernière itération. Vraiment une bonne réponse.
Magique Octopus Urn
@MagicOctopusUrn: Nous pourrions facilement libérer 10et créer quelque chose en binaire. Mais je ne sais pas si nous pouvons générer le premier programme à partir de binaire sans B.
Emigna
2
@MagicOctopusUrn: Votre tâche est peut-être un peu plus ardue car je pense avoir une chaîne à cinq chaînes;)
Emigna
2
@MagicOctopusUrn: Je serai heureux de :) C'était un défi très amusant!
Emigna
1
Félicitations pour avoir obtenu la 5ème chaîne!
Chromium
12

Java 8, chain of 2 functions, 90+10 37+4 28+4 = 32 bytes

o\u002D\u003E"\44\55\76"+2/2

Which is equivalent to:

o->"$->"+2/2

-57 bytes thanks to @OlivierGrégoire.

Try it online.

Which returns the String:

$->1

Try it online.

Which returns the integer:

1
Kevin Cruijssen
la source
\u0076\u002D\u003E\u0022\u0076\u002D\u003E\u0022+(3\u002D2) (59 bytes+4 bytes). The rules says "None of your programs may share any characters", so v->1 is valid because the final 1 isn't a program.
Olivier Grégoire
1
39 bytes + 4 bytes
Olivier Grégoire
@OlivierGrégoire I knew v->1 returning 1 is valid, but in my original answer \u0031 would contain a 1, and v->1 would then contain a 1 as well. Nice combination of both unicode Java and regular Java, though. And I golfed 2 more by changing (2/2) to 2/2. (PS: There is also already a chain-3 Java answer by Jakob.)
Kevin Cruijssen
@OlivierGrégoire Correction, I've been able to golf it to 28+4 by using "\44\55\76" instead of "\u0076\u002D\u003E"
Kevin Cruijssen
Nice golfing on top of mine ;) I haven't checked the 3-chain answer yet. I'll do it right now.
Olivier Grégoire
10

R, 3-chain 198 + 44 + 3 bytes

`+`=`\143\141\164`;+"\143\141\164\050\151\156\164\124\157\125\164\146\070\050\143\050\070\070\055\071\055\071\054\071\071\071\055\070\070\071\055\070\055\070\054\070\070\055\071\055\071\051\051\051"

Try it online!

Returns :

cat(intToUtf8(c(88-9-9,999-889-8-8,88-9-9)))

Try it online!

Returns :

F^F

Try it online!

Returns 1

Explanation :

The first program is almost totally written in octal representation, where each character is written as \xxx where xxx is the ASCII code in octal mode. In human readable form would be :

`+`=`cat`;+"cat(intToUtf8(c(88-9-9,999-889-8-8,88-9-9)))"

Here, to avoid the use of round brackets we redefine the prefix operator + equal to cat function, then we use that to print the next string. Even after assigning cat to +, the latter still keeps its prefix operator "status" and will just take whatever follows it as its first parameter.

The second program, simply prints the characters F^F obtaining them from decimal ASCII : 70,94,70

Since in the first program we used the octal representation, only numbers 8 and 9 are free to be used; hence, we obtain 70 and 94 with some differences between numbers with only 8's and 9's.

Finally, the last program, F^F, exploits the ^ function (power of) which coerces FALSE to 0 and computes 0^0 returning 1

Credits to :

  • @ngm for the first 2-chain idea
  • @Giuseppe for the hint to use octals in functions
  • @BLT and @JayCe for the idea to override + in order to avoid brackets

Previous version :

R, 2-chain 27+3 24 + 2 bytes

cat(intToUtf8(c(49,76)))

Try it online!

Returns:

1L

Try it online!

Returns 1.

digEmAll
la source
Nice one! Is cat mandatory?
JayCe
2
Well potentially you could have an output as a string with "wri\164e"(function args) to avoid a t or other similar encodings
Giuseppe
1
@Giuseppe @digEmAll According to the latest comments to the question cat(intToUtf8(c(49,76))) would work and is a bit shorter. Doesn't expand the chain though.
JayCe
2
@digEmAll See BLT's comment to my answer to another challenge... I think there might be something here.
JayCe
2
I've made this answer a Community Wiki. Please feel free to add this with a little explanation.
ngm
8

Python 2, 2-Chain, 7+44 = 51 bytes

lambda:("7072696e74203"+`3-2`).decode("hex")

and

print 1

Try it online!

The base 16 code translates to print 1, which is returned by the anonymous function.

Jo King
la source
7

Perl 5, 3-chain, 151 139 chars (114 + 20 + 5)

&{"CORE::SYSWRITe"|"CORE::39372!4"}(STDOUT,"\x70\x72\x69\x6E\x74\47\x50\x42\x5A\3\22\47\x5E\47\43\43\43\43\43\47")

The ugliness inside the &{ } evaluates to CORE::syswrite, and so the hex-escaped string is printed to standard output as:

print'PBZ^C^R'^'#####'

Please note that the ^C and ^R in the above represent literal control characters. (And not to be confused with the literal ^ caret that occurs between the two strings.)

This program in turn outputs:

say 1
breadbox
la source
6

Cjam, 4-chain, 28+20+3+1=52 bytes

Snippet 1:

"tugshrm\x18$\x18vj\x1b\x07um~l$\x1b"{71^}%

Snippet 2:

32 4/5*_c_1-\@2*9+c\

Snippet 3:

'Y(

Snippet 4:

X

Which then prints 1.

Try it online!

Note:

  1. Since Cjam does not have interpretation for escape characters, the ones in snippet 1 are only there for better web view. You need to use the corresponding actual characters to run the snippet.

  2. If I cannot shave off more characters, then good job to @Emigna for the 05AB1E answer!

Chromium
la source
In snippet 2 you've reused the character 1 used in snippet 1
digEmAll
See my note please. The escape characters are for the reader's convenience, in Cjam there are no escape characters, or they would not translate into the characters you think would in languages like C or python. When testing, you literally have to enter the characters manually instead of using the escape characters.
Chromium
ah I see, thanks
digEmAll
5

Excel, Chain 2, 27+3 bytes

=CHAR(45)&CHAR(45)&CHAR(49)

Not sure if this is OK...

tsh
la source
2
Shouldn't there be a CHAR(61)& in the beginning as well for there to be a chain of 2?
Emigna
5
You should use french instead of english (CHAR become CAR, 3 bytes saved), not sure if another language reduce it more
Sefa
1
@Emigna But it seems typing --1 in a cell and hit enter, it would just show 1 on the screen...
tsh
@tsh: Hmm, yeah it seems like Excel adds the = implicitly if you type --1.
Emigna
1
@Neil Excel does not insert a = mark for +1 (but it does for --1), so I won't consider it as an expression. And I'm not sure if simply writing an 1 in the cell and call it "output 1" is valid. That's why --1 is used.
tsh
5

x86 bytecode, Chain 2, 10+4 bytes

(Assembled with FASM, format PE)

ÇA.Ï?¿<÷Y. produces 1À@Ã in the address next to it and executes it, which returns 1 in eax (as per fastcall). In both cases the . actually represents A or LF.

In hex: C7 41 0A CF 3F BF 3C F7 59 0A and 31 C0 40 C3.

Disassembled:

mov dword ptr ds:[ecx+A],3CBF3FCF
neg dword ptr ds:[ecx+A]         

produces

xor eax,eax                      
inc eax                          
ret                              

This (ab?)uses the fact that the entrypoint of the program is stored in ecx, and then writes the inverse of the to be executed code to the address 10 bytes over and negates it.

May or may not break if assembled with anything but fasm, to anything but a PE or with a different entrypoint.

S.Klumpers
la source
5

JavaScript REPL, lots of bytes, 4 iterate

(+!![]+[!![]+!![]+!![]+!![]]+![]+![]+(+!![])+![]+(+!![])+(+[])+![]+(+!![])+(+!![])+![]+![]+(!![]+!![]+!![])+![]+(!![]+!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(!![]+!![]+!![]+!![])+![]+![]+(+!![])+(!![]+!![])+![]+(+!![])+(!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(!![]+!![]+!![]+!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(!![]+!![]+!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(+!![])+(!![]+!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(+!![])+(!![]+!![]+!![])+![]+![]+(!![]+!![]+!![])+![]+(!![]+!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(!![]+!![]+!![]+!![])+![]+![]+(+!![])+(!![]+!![])+![]+(+!![])+(!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(!![]+!![]+!![]+!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(!![]+!![]+!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(+!![])+(!![]+!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(+!![])+(!![]+!![]+!![])+![]+![]+(+!![])+![]+(+!![])+(+[])+![]+(+!![])+(+!![])+![]+![]+(+!![])+(!![]+!![])+![]+(+!![])+(+[])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(!![]+!![]+!![]+!![]+!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(+!![])+(+!![])+![]+![]+(+!![])+![]+(+!![])+(+[])+![]+(!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![])+![]+![]+(+!![])+![]+(+!![])+(+[])+![]+(+!![])+(!![]+!![]+!![]+!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(!![]+!![]+!![])+![]+![]+(+!![])+![]+(+!![])+(+[])+![]+(+!![])+(+!![])+![]+![]+(+!![])+![]+(+!![])+(+[])+![]+(+!![])+(+!![])+![]+![]+(+!![])+(!![]+!![])+![]+(+!![])+(+[])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(!![]+!![]+!![])+![]+![]+(+!![])+![]+(+!![])+(+[])+![]+(!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![])+![]+![]+(+!![])+![]+(+!![])+(!![]+!![])+![]+(!![]+!![]+!![]+!![]+!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(!![]+!![]+!![])+![]+![]+(+!![])+![]+(!![]+!![])+![]+(!![]+!![]+!![]+!![]+!![]+!![]+!![])+![]+![]+(+!![])+![]+(+!![])+(+[])+![]+(+!![])+(!![]+!![]+!![]+!![]+!![])+![]+![]+(+!![])+![]+(+!![])+(+[])+![]+(!![]+!![]+!![]+!![]+!![])+![]+![]+(+!![])+![]+(+!![])+(+[])+![]+(!![]+!![])+![]+![]+(+!![])+![]+(+!![])+(+[])+![]+(+!![])+(+!![])+![]+![]+(+!![])+![]+(+!![])+(+[])+![]+(+!![])+(+!![])+![]+(+!![])+(!![]+!![]+!![]+!![]))[(![]+[])[!![]+!![]+!![]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]][([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+([][[]]+[])[+!![]]+(![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+[]]+([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(!![]+[])[+!![]]]((!![]+[])[+!![]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+!![]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]]+[])[!![]+!![]+[+[]]]+([][(!![]+[])[!![]+!![]+!![]]+([][[]]+[])[+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([![]]+[][[]])[+!![]+[+[]]]+(!![]+[])[!![]+!![]+!![]]+(![]+[])[!![]+!![]+!![]]]()+[])[!![]+!![]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(![]+[])[+!![]])()([][[]]))[+!![]+[+[]]]+(![]+[])[!![]+!![]]+([![]]+[][[]])[+!![]+[+[]]]+(!![]+[])[+[]]](![])[(+(!![]+!![]+[+[]]+(+!![])+(!![]+!![])+(!![]+!![]+!![]+!![]+!![])))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+([]+[])[([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+([][[]]+[])[+!![]]+(![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+[]]+([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(!![]+[])[+!![]]][([][[]]+[])[+!![]]+(![]+[])[+!![]]+([]+(+[])[([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+([][[]]+[])[+!![]]+(![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+[]]+([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(!![]+[])[+!![]]])[+!![]+[+!![]]]+(!![]+[])[!![]+!![]+!![]]]](!![]+!![]+!![]+[+[]])](([]+[])[([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]][([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+([][[]]+[])[+!![]]+(![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+[]]+([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(!![]+[])[+!![]]]((!![]+[])[+!![]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+!![]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]]+[])[!![]+!![]+[+[]]]+([][(!![]+[])[!![]+!![]+!![]]+([][[]]+[])[+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([![]]+[][[]])[+!![]+[+[]]]+(!![]+[])[!![]+!![]+!![]]+(![]+[])[!![]+!![]+!![]]]()+[])[!![]+!![]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(![]+[])[+!![]])()(+[]+[![]])[!![]+!![]+!![]]+(![]+[])[+!![]]+(!![]+[])[+!![]]+(+[![]]+[][(!![]+[])[!![]+!![]+!![]]+([][[]]+[])[+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([![]]+[][[]])[+!![]+[+[]]]+(!![]+[])[!![]+!![]+!![]]+(![]+[])[!![]+!![]+!![]]]())[+!![]+[+!![]]]+(!![]+[])[+[]]][([][(!![]+[])[!![]+!![]+!![]]+([][[]]+[])[+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([![]]+[][[]])[+!![]+[+[]]]+(!![]+[])[!![]+!![]+!![]]+(![]+[])[!![]+!![]+!![]]]()+[])[!![]+!![]]+([![]]+[][[]])[+!![]+[+[]]]+([][[]]+[])[+!![]]+([][[]]+[])[!![]+!![]]]([][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]][([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+([][[]]+[])[+!![]]+(![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+[]]+([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(!![]+[])[+!![]]]((!![]+[])[+!![]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+!![]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]]+[])[!![]+!![]+[+[]]]+([][[]]+[])[+[]]+([][[]]+[])[+!![]]+(!![]+[])[!![]+!![]+!![]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]+[+[]]]+(![]+[])[+!![]]+(![]+[])[!![]+!![]])()(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+[+!![]]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]][([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+([][[]]+[])[+!![]]+(![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+[]]+([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(!![]+[])[+!![]]]((!![]+[])[+!![]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+!![]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]]+[])[!![]+!![]+[+[]]]+([][(!![]+[])[!![]+!![]+!![]]+([][[]]+[])[+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([![]]+[][[]])[+!![]+[+[]]]+(!![]+[])[!![]+!![]+!![]]+(![]+[])[!![]+!![]+!![]]]()+[])[!![]+!![]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(![]+[])[+!![]])()(![]+[![]])[+!![]+[+[]]]+(!![]+!![]+!![]+!![]+!![]+!![]+!![])+(!![]+!![]+!![]+!![])+([][(!![]+[])[!![]+!![]+!![]]+([][[]]+[])[+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([![]]+[][[]])[+!![]+[+[]]]+(!![]+[])[!![]+!![]+!![]]+(![]+[])[!![]+!![]+!![]]]()+[])[!![]+!![]]+(!![]+[])[!![]+!![]+!![]]+(!![]+!![]+!![])+(!![]+!![])+([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(![]+[])[+[]]+(!![]+!![]+!![]+!![]+!![]+!![])+(+[])+(!![]+!![]+!![]+!![]+!![])+([][[]]+[])[!![]+!![]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+([][[]]+[])[+!![]]+(!![]+[])[+[]]+([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(!![]+[])[+!![]]]()[+!![]+[!![]+!![]]]+(!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![])))[([][(!![]+[])[!![]+!![]+!![]]+([][[]]+[])[+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([![]]+[][[]])[+!![]+[+[]]]+(!![]+[])[!![]+!![]+!![]]+(![]+[])[!![]+!![]+!![]]]()+[])[!![]+!![]+!![]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+([![]]+[][[]])[+!![]+[+[]]]+([][[]]+[])[+!![]]]([])
"\x60\44\x7b\55\x7e\x7b\x7d\x7d\44\x7b\55\x7e\x7b\x7d\x7d\x60\56\x73\x70\x6c\x69\x74\x60\x60\56\x74\x6f\x53\x74\x72\x69\x6e\x67\x60\x60"
`${-~{}}${-~{}}`.split``.toString``
1,1
1

Too lazy to optimize the JSFUCK code

JavaScript REPL, 164 bytes, 3 iterate

may be able to expand

[g=222222222222222222,e=2e40,f=2e23,f,2e40,n=2222e49,r=2e24,2e30,e,n,r,8e28,2e40,n,r,9e29,g].map(S=>String.fromCharCode(Math.log(S))).join([])
'\55\x7E\x7B\x7D'
-~{}
1

Try it online!

l4m2
la source
@JoKing I didn't use 1 in other pros, so the first 1 is program and the 2nd one is result
l4m2
Aren't you reusing the {}s?
Neil
@Neil Fixed and optimized
l4m2
"The chain ends the first time 1 is outputted."
12Me21
5

CJam, 7-chain, 92365+1819+79+14+9+3+1 bytes

This 92365-byte program prints

YaY+`$1<mR1+1+1+1+1+1+11+1+1+YaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR11+11+YaY+`$1<mR1+11+11+YaY+`$1<mR1+1+1+1+1+1+11+1+1+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR11+11+YaY+`$1<mR1+1+1+1+1+1+11+1+1+1+1+YaY+`$1<mR11+11+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR11+11+YaY+`$1<mR1+11+11+YaY+`$1<mR1+1+1+1+1+1+11+1+1+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR11+11+YaY+`$1<mR1+1+1+1+1+1+11+1+1+1+1+YaY+`$1<mR11+11+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+1+1+YaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR11+11+YaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR11+11+YaY+`$1<mR1+1+1+1+1+1+11+1+1+1+1+YaY+`$1<mR11+11+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR11+11+YaY+`$1<mR1+11+11+YaY+`$1<mR1+1+1+1+1+1+11+1+1+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR11+11+YaY+`$1<mR1+11+11+YaY+`$1<mR1+1+1+1+1+1+11+1+1+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR1+11+11+YaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR1+1+1+1+1+11+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+YaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+1+1+YaY+`$1<mR1+1+1+1+1+11+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+YaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR1+11+11+YaY+`$1<mR1+1+1+1+1+11+YaY+`$1<mR1+11+11+YaY+`$1<mRYaY+`$1<mR1+1+1+1+1+1+11+1+1+1+1+YaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR1+11+11+YaY+`$1<mR1+11+11+YaY+`$1<mR1+1+11+11+11+11+11+1+1+1+1+YaY+`$1<mR11+11+11+11+11+11+11+1+1+1+1+1+1+1+1+1+1+1+1+1+1+YaY+`$1<mR1+1+11+11+11+11+YaY+`$1<mR1+11+11+YaY+`$1<mR1+1+1+1+1+11+11+1+1+YaY+`$1<mR11+11+YaY+`$1<mR1+1+1+1+1+1+11+1+1+1+YaY+`$1<mR1+11+11+YaY+`$1<mR1+11+11+YaY+`$1<mR1+11+11+YaY+`$1<mR1+1+11+YaY+`$1<mR1+11+YaY+`$1<mR1+1+1+1+1+11+11+1+1+YaY+`$1<mR11+11+11+11+11+11+11+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+YaY+`$1<mR1+1+1+1+1+

which prints

34 4673 4656 4673 4656 5464 4656 4673 4673 4740 34 50 34707 5477]{N7=64777-,=}%

which prints

";*;*Q*;;~"2f^

which prints

9(9(S(99|

which prints

88c

which prints

X

which prints 1.

Lynn
la source
5

MATL, 5 programs, 404+159+35+4+1 = 603 bytes

Getting to 4 programs was hard. 5 programs was very hard!

'/'37 13+3+3+'3`/'37 13+3+3+77 13+37 13+3+3+'3`/'37 13+3+3+'3tttttttt`/'37 13+3+3+'3#'37 13+3+3+'3ttttt`'37 13+3+3+'3ttttt'37 13+3+3+77 13+'/'37 13+3+3+'3`<<tttttttttt'37 13+3+3+'3#'37 13+3+3+77 13+37 13+3+3+'3///<3////t````ttttt```<</////t`````t<3tttttttttt<3tt/'37 13+3+3+'3ttttttttt'37 13+3+3+'3`{'37 13+3+3+77 13+'y$'37 13+3+3+'3/////t`````ttI#I'77 13+3+'dk'hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh3_+''h

Try it online!

,50],5W50],50qqqqqqqq],50 50qqqqq]50qqqqq5W,50]99qqqqqqqqqq50 5W50,,,90,,,,q]]]]qqqqq]]]99,,,,,q]]]]]q90qqqqqqqqqq90qq,50qqqqqqqqq50]x5Wv!50,,,,,q]]]]]qqF FZah

Try it online!

This might be my favorite program I've written on PPCG:

22 2 2**2-2-- 22Y2 2EEEEEEEEBPX)2) 

Try it online!

84
c

Try it online!

T

Try it online!

Explanation:

Having used hours on this program, I won't write the entire explanation now! I'll write it later!

Short summary:

T            -> Literal true = 1

84c          -> Convert 84 to its ASCII-character T

22 2 2**...  -> Calculate 84 using only 2, * and -
 22Y2        -> 22Y2 is a cell array with the name of all the months
 2EE..B      -> Is 512 in binary [1 0 0 ...]
 P           -> Flips is, [0 0 ... 1]
 X)          -> Uses the binary vector as index and gets the 10th element
             -> 'October'
2)           -> The second character, 'c'
             -> Resulting in the stack: 84, 'c' that's implicitly printed

,50]...      -> A string with ASCII character codes of '22 2...
             -> There's a lot of ,xyz], which means "do twice" and q which is decrement

In order to convert this to a string instead of character codes, we need to concatenate it with a string using h. To get a string, without using quotes, or the XY modifiers, we do base conversion and convert an integer to whitespace.


'/'37 13 ...  -> Concatenation of strings and character codes using only available numbers
3_+           -> Subtract 3 from all character codes to get the correct ones
''h           -> And concatenate with the empty string.
Stewie Griffin
la source
4

CJam, 10 programs, 5,751,122,990 bytes

I was too lazy to golf it... But apparently I don't need to golf it to be competitive. But without golfing it is a bit difficult to post the solution in an answer.

It should work in the JavaScript interpreter in theory, but the program is too long to be tested in a browser. It should output the same in the Java interpreter except for the last program. But it may also run out of memory in the Java interpreter for the first few programs.

Statistics

5683631402 bytes, used )\_l
  65027874 bytes, used %&<>WXehrstu{|} and newline
   2247044 bytes, used +DEFHIS~
    199997 bytes, used ,38=[]`
     15352 bytes, used -25:N and space
      1181 bytes, used 67c
        84 bytes, used #'(@CKMTgkp
        21 bytes, used !"$?BJLQR^fijo
        16 bytes, used */4AGYZabdy
        19 bytes, used .09
         1 byte,  used 1

First bytes

l)__)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))...
\n{s}sX>X<eu{h}sX>X<eu{\n}sX>X<{{XXXXXXX}seeseeseeW>{X<{|}%}%}%{|}sX>X<{{X}se...
SH+~+E+E+E+SH+~+H+E~+SH+~+H+E~+SI+~+H+D+D+SI+~+I+E+E+SH+~+H+E~+SF+~+E+SD+~+D+...
[33]`3=,3333=[33]`3=,388333=[8]`88=,8333=[8]`88=,8333=[8]`88=,8338=[8]`88=,33...
N:--25--22- 2-N:--25--22- 2-N:--22--22-N:--25--22- 2-N:--25--22- 2-N:--22--22...
776776777767c677676676677667c66677666676776c776776777767c7667776c666776666767...
'#('@('T(('k(('T((('k(('K('p(''((('@('T(('k(('T((('k(('k('M('#(('#('C('g('g((...
"?RiQiJo$?RiQijL!"Bf^
4YbZbAd/4YbZbaG*
0.99999999999999999
1

\n is newline in the second program.

Generator

"'#('@('T(('k(('T((('k(('K('p(''((('@('T(('k(('T((('k(('k('M('#(('#('C('g('g((((((((("

{_[i1:X;{_1&6+ \1$X*X5*:X;- 2/}16*;]__,,:)\f<Wf%10fb:c@#)<W%'c}%s

"67c"
"N:--22--22-
N:--25--22- 2-
N:--55--25--5--2--2-"N/ers

"N:-25 "
"[33]`3=,3333=
[33]`3=,388333=
[8]`88=,8333=
[8]`88=,8338=
[8]`88=,333=
[8]`88=,88="N/ers

"[]`38=,"
"SH+~+E+E+E+
SI+~+H+D+D+
SI+~+I+E+E+
SH+~+H+E~+
SI+~+I+D~+H+E~+
SF+~+E+
SD+~+D+D~+"N/ers

"SDEFHI+~"
"{s}sX>X<eu
{t}sX>X<{{XXXXXXXX}s{X}s{XXXXXX}erseeW>{X<{&}%}%}%
{ee}sX>X<eu
{&}sX>X<{{XXXXXXs}s{X}s{XXXXXX}erseeW>{X<{|}%eu}%}%
{h}sX>X<eu
{h}sX>X<eu{X|}%
{N}sX>X<{{XXXXXXX}seeseeseeW>{X<{|}%}%}%
{|}sX>X<{{X}seeW>{X<{|}%}%}%"N/'Nf/Nf*erN\+s

1>"l)_"o)\{'_oi10-')*o'\o}/i10-')*o
jimmy23013
la source
3

APL (Dyalog), 2 chain, 15+2 = 17 bytes

AV[2+⎕AV'⍳.']

Try it online!

Outputs the program

*0

That outputs

1
Uriel
la source
3

JavaScript (ES6), 2 functions, 31+4 = 35 bytes

function(){return atob`Xz0+MQ`}

returns _=>1, which returns 1

Arnauld
la source
Wouldn't function invocation have to be part of each program?
TehShrike
@TehShrike Functions were explicitly allowed in the rules. (A function + its invocation code would be a full program. So, I don't think that would make much sense.)
Arnauld
Oh good call, I missed that 👍
TehShrike
3

Jelly,  38 37 36  35 bytes, Chain of 4

ØJiⱮ⁾ɱṾ⁽÷ṃ;ṾØJ⁽¡Ṡị

Try it online! (18 bytes)

8220,163,187Ọ

Try it online! (13 bytes)

“£»

Try it online! (3 bytes)

!

Try it online! (1 byte)

18+13+3+1=35 bytes

How?

ØJiⱮ⁾ɱṾ⁽÷ṃ;ṾØJ⁽¡Ṡị - Main Link: no arguments
    ⁾ɱṾ            - list of charcters -> ['ɱ','Ṿ']
ØJ                 - yield the characters of Jelly's code-page
   Ɱ               - Ɱap across the two characters applying:
  i                -   first index of? -> [163, 187]
       ⁽÷ṃ         - 8220 (a base 250 compressed number)
          ;        - concatenate -> [8220, 163 187]
           Ṿ       - un-eval (get Jelly code) -> "8220,163,187"
                   - (Note: here a full program prints 8220,163,187 as it is the end
                   - of a leading constant chain due to the following constant)
            ØJ     - yield the characters of Jelly's code-page
              ⁽¡Ṡ  - 1206 (a base 250 compressed number)
                 ị - index into (1-indexed & modular, so gets the 182nd item, 'Ọ')
                   - implicit print (making the final output 8220,163,187Ọ)

8220,163,187Ọ - Main link: no arguments
8220,162,187  - list of numbers -> [8220, 162, 187]
            Ọ - cast ordinals to characters -> ['“','£','»']
              - implicit print (flat Jelly lists print as if strings so outputs “£»)

“£» - Main link: no arguments
“   - open string-literal
 £  - the content of the string-literal
  » - close it interpreting as a compressed string
    - this yields ['!']
    - implicit print (outputs !)

! - Main link: no arguments
! - factorial (of implicit input 0 - 0! = 1 as it is the empty product)
  - implicit print (outputs 1)
Jonathan Allan
la source
3

Python 2, 3 snippets, 68 + 12 + 3 = 83 bytes

chr(44*2+4).join([chr(42&54),`45+25`,`42*2+52`,`4*4+55`+chr(42&54)])

which produces the string of octal literals:

"\70\136\71"

which produces:

8^9

Which finally produces 1.

Try it online!

Jo King
la source
3

Java 8, 3 programs, 431 bytes

Program 1, 332 bytes

A lambda from one (empty) parameter of any type to String.

x\u002D\u003E"\151\156\164\40\157\75\70\46\70\52\70\54\156\75\53\53\157\53\70\73\156\145\167\40\123\164\162\151\156\147\50\51\53\50\143\150\141\162\51\50\47\171\47\53\157\51\53\50\143\150\141\162\51\50\47\54\47\53\157\51\53\50\143\150\141\162\51\50\47\75\47\53\157\51\53\156\53\50\143\150\141\162\51\50\47\56\47\53\157\51\53\156\73"

This is just a lambda with the arrow characters Unicode-escaped returning the text of the second program encoded with octal escape sequences.

Try It Online

Program 2, 93 bytes

Snippet producing a String.

int o=8&8*8,n=++o+8;new String()+(char)('y'+o)+(char)(','+o)+(char)('='+o)+n+(char)('.'+o)+n;

Try It Online (with return added)

Program 3, 6 bytes

A lambda from one (empty) parameter of any type to int.

z->9/9

Try It Online

Jakob
la source
2
Nice answer! You can golf \166 to \44 for -1 byte, since $ is also a valid variable name. Try it online, resulting in $->9-8 (Try it online.)
Kevin Cruijssen
After several tries, it's just not possible to make a 3-chain with Java. You need the \uXXXX in the first code to avoid ->. Then you need either return (function) or System.out (snippet or function), both contain a u which you already used in \uXXXX. So I personally think this entry is invalid and I downvoted it accordingly.
Olivier Grégoire
@OlivierGrégoire Snippets are explicitly allowed in this challenge (first rule). In addition, System.console().printf could be used to prevent the use of u. Something similar is done in this answer and I've also used it in these two answers of mine.
Kevin Cruijssen
Thanks @KevinCruijssen but a snippet must still output. Here's a fix around all: x->"\146\157\162\50\143\150\141\162\40\44\72\156\145\167\40\143\150\141\162\133\135\173\47\171\47\54\47\54\47\54\47\75\47\54\47\70\47\54\47\56\47\54\47\70\47\175\51\123\171\163\164\145\155\56\143\157\156\163\157\154\145\50\51\56\160\162\151\156\164\146\50\53\53\44\53\156\145\167\40\123\164\162\151\156\147\50\51\51\73" (319 bytes) turns into for(char $:new char[]{'y',',','=','8','.','8'})System.out.printf(++$+new String()); (89 bytes) turns into z->9/9 (6 bytes). Total: 404 bytes.
Olivier Grégoire
I meant System.console() for the 2nd program, which is correctly 89 bytes (while the System.out makes it 83 bytes).
Olivier Grégoire
2

SmileBASIC, chain 3, 375 bytes

k=59599-44444print c("sbanm",k,4,"")+c("sbwav",44-5,2,"")+c("sbwav",594-222,4,"")+c("game5vs",4528-442,2,"")+c("sbanm",k,4,"")+c("sbanm",72,5-4,"")*2+c("sbwav",594-222,4,"")+c(sbwav,854-44,2,"")+c("staffroll",259+2,9,"")+c("ex8techdemo",24455,5-2,"")+key(4)[.]def c(f,s,l,q)for i=.to-5+l+4q=q+load("txt:sys/"+f,.)[s+i]next:return q:end

Outputs:

CHR$63OUT A$CHR$33OUT B$PRINT A$;B$;L

Outputs:

?!0

Outputs:

1
12Me21
la source
2

PHP 7.0, 2-chain, 35 + 8 = 43 bytes

While writing my initial answer I realized I could just use base64 encode the second echo. It shaved off 11 bytes, so here it is. You can find my original idea below, too.

Run using php -r:

echo base64_decode('RUNITyAxPz4=');

This outputs:

ECHO 1?>

Which then obviously prints:

1

Output:

Code run with additional && echo for readability
My code when run in a terminal. The appended && echo is for readability only.

Comments:

There's not much to it really. Very simple once you know about "?>" implicitly acting as ";". The "tricky" part was to figure out what to encode:

  • ECHO 1; became RUNITyAxOw==, so we have a collision of uppercase O's. No good.
  • echo 1; became ZWNobyAxOw==, so now there's two lowercase o's. Unfortunate!
  • ECHO 1?> became RUNITyAxPz4=. It's the same length and none of the characters collide. So that's it!

Alternatively we can use "echO" and "ECHo", too (36 + 7 = 43 bytes).

echO base64_decOde('RUNIbyAxOw==')?>
ECHo 1;
1

We can also switch the ; and ?> around using that. It works equally well and it all scores the same in length.



My initial solution:

PHP 7.0, 2-chain, 44 + 10 = 54 bytes

This is the best I could come up with at first. I understood that "unique characters" meant "echo" is not equal to "ECHO". Hope I got that right!

Run using php -r:

echo strtoupper(urldecode('echo true%3b'))?>

This outputs:

ECHO TRUE;

Which in turn gives us our number:

1

Output:

Code run with additional && echo for readability
My code when run in a terminal. The appended && echo is for readability only.

Some comments:

  • I think you can only do a 2-chain in PHP since it requires the ";" instruction separator.
    • You can get around this once by using "?>", which implies a semicolon, but obviously can't re-use it a second time
    • This was the hardest part for me to figure out. I didn't know this worked beforehand, nor that "?>" was even allowed when running via php -r
  • By using strtoupper() I was able to just write the code for chain #2 in lowercase, while the output is obviously uppercase. Easy mode right there!
  • urldecode() allows me to encode ";" as "%3b"
  • That's all there is really, nothing too exciting

Thanks for the challenge, I learned something today!

Maz
la source
2

Lua, 2 chain, 83+8=91 bytes

load(('').char(0x70,0x72,0x69,0x6E,0x74,39,0x70,0x72,0x69,0x6E,0x74,34,49,34,39))()

Outputs

print"1"

Which outputs

1
GalladeGuy
la source
1

Charcoal, 2 programs, 10 + 2 = 12 bytes

⭆´G´·℅⊕⊕℅ι

Try it online! Outputs

I¹

Try it online! Which outputs 1.

Neil
la source
1

Röda, 2 chain, 31 + 3 = 34 bytes

Snippet 1:

(`X.Z`/"")|ord _|push _+3|chr _

Try it online!

Snippet 2:

[1]

Try it online!

They are snippets, because every valid Röda program must include main{...} bloat. They are also valid Röda REPL programs.

fergusq
la source
1

dc, 3 programs, 48 bytes

First:

82 2-adAArdAAI2*-rAAI-I2/2^-f

Yields the second:

75
P
90
P
110
P

Yields the third:

KZn

Yields 1.

Try it online! (has some stack-clearing and newline-printing code thrown in to make all three bits run in one go).

Perhaps best to start at program three, KZn. There are only a few ways to print things in dc, and I realized at this stage I would probably be stuck with either p or n, both of which are in the 100s in decimal ASCII. This means that I was almost certainly going to have to generate 1 instead of just using the program 1n. K pushes the current (default: 0) precision to the stack, and Z pushes the number of digits of top-of-stack, which gives us the 1 to print.

The second program is pretty straightforward. P prints the character with the given ASCII value, so we print 75 (K) 90 (Z) and finally 110 (n), which works wonderfully. It also means that, aside from the aforementioned 1, I can't use the digits 5, 7, 9, or 0 elsewhere. I also need a method other than P for turning numbers into characters.

The first program, then, has to make four numbers without using the digits 1, 5, 7, 9, or 0. It needs to make 80 (ASCII value of P): 82 2-; 75: AA (110) I- (subtract the default input radix, 10) I2/ (so, 5) 2^ (so, 5^2, 25) - (75); 90: AA (110) I2* (twice the default input radix of 10, so 20) - (90); and 110: well, it's just AA. After making 80, we use a to convert a number to a string. There are some reverse and duplicate commands in there to put the Ps in the right spots, and then finally we print the whole stack with f.

I'm pretty sure I didn't screw this up, but I did have my head spinning a little bit...

brhfl
la source
1

05AB1E, 5 + 3 = 8 bytes

ght<n

Try it online!

which right off the bat returns

I am taking the output 1.0 as not equalling 1, so I run that code:

1.0

Try it online!

which returns

1

And there you go!

Number of programs = 2

Caleb Evans
la source
Welcome to PPCG.
Muhammad Salman
I just tried to write random things and see what i get. Also, one might use a turing machine program.
Caleb Evans
You can remove the h (convert to hexadecimal). The g (get length, default 0) with t (square-root) already gives a decimal 0.0. With < (decrease by 1) it becomes -1.0 and then n (square) changes this into 1.0. You could also replace the <n with > (increase by 1). ;) So in total it's 3 bytes (gt>). Alternatively you could use Xt (1 and square-root). PS: I'm not sure if 1.0 to 1 is a valid part of the chain. I've asked OP to verify. Welcome to PPCG and enjoy your stay.
Kevin Cruijssen
well, computers process the string '1.0' differently than '1'.
Caleb Evans
0

Ruby, 2-chain, 24+3 = 27 bytes

$><<(''<<56+56<<' '<<49)

Output is

p 1
G B
la source