Golf una quine mutua

38

Usando dos idiomas de su elección, escriba el " quine mutuo" más pequeño que pueda.

Es decir, escriba un programa P en el lenguaje A que muestre el código fuente de un programa Q en el lenguaje B, de modo que la salida del programa Q sea idéntica al código fuente de P.

Los archivos vacíos no cuentan, ni los programas de estilo "leer el archivo fuente e imprimirlo".

Editar: Las respuestas con P = Q ya no cuentan.

dan04
fuente
9
Por cierto, esto debería excluir los casos en que las fuentes coincidan. Por ejemplo 1es una quine en varios idiomas. Entonces podría decir que es un programa J que imprime un programa Golfscript que imprime un ...... y así sucesivamente.
cthom06
puede adoptar la regla de "Trate de evitar o no use envíos de 1 byte como este, ya que arruina toda la diversión". de codegolf.stackexchange.com/questions/1393/…
Ming-Tang
2
Se debe publicar una solución Brainfuck + Befunge.
pyon
¿Puede el lenguaje A = lenguaje B?
programador
Dado que esto es golf, ¿puedes aclarar los criterios de puntuación? Por ejemplo, ¿el puntaje final es la suma de los recuentos de bytes de P y Q? ¿O el mínimo de la cuenta de bytes de P y Q?
b_jonas

Respuestas:

15

> <> (Pez) y Python - 26 caracteres

"00gr00g:a9*2+$' tnirp'>o<

Genera este Python

print "\"00gr00g:a9*2+$' tnirp'>o<"
cthom06
fuente
Tiene un problema con el código> <> porque "y 'habilita el análisis de cadenas, por lo que todo el programa simplemente se inserta en la pila y nunca se muestra.
Kevin Brown
2
@ Bass5098 Así es exactamente cómo funciona todo. El primero "habilita el análisis de cadenas. Lee todo el programa y luego vuelve al primero "y ejecuta el programa consigo mismo en la pila
cthom06
Se solucionó el problema en mi intérprete. Su código> <> print \00gr00g:a9*2+$' tnirp'>o<sale después del tiempo de espera. Estoy bastante seguro de que esto se debe a que gcopia el contenido real de la celda, pero ogenera la versión ASCII del carácter y "no es un código de carácter ASCII válido. ideone.com/kaM0r
Kevin Brown
55
@ Bass5098 "es ASCII 34. Su intérprete debe estar apagado.
cthom06
31

Python y Ruby, 39 personajes

Este fragmento de Python

s='puts %%q{s=%r;print s%%s}';print s%s

genera este fragmento de Ruby

puts %q{s='puts %%q{s=%r;print s%%s}';print s%s}

que luego genera nuevamente el fragmento de Python inicial:

$ diff -s mutualquine.py <(ruby <(python mutualquine.py))
Files mutualquine.py and /dev/fd/63 are identical

Tenga en cuenta que esto es similar a la respuesta de JB .

Ventero
fuente
23

C y Perl, 73

Esta C:

main(s){printf(s="print q<main(s){printf(s=%c%s%c,34,s,34);}>",34,s,34);}

... genera el siguiente Perl:

print q<main(s){printf(s="print q<main(s){printf(s=%c%s%c,34,s,34);}>",34,s,34);}>

... que devuelve la C.

JB
fuente
1
Ahorre 4 bytes:main(s){printf(s="print q<main(s){printf(s=%c%s%1$c,34,s);}>",34,s);}
MD XF
14

C y C ++, 123 caracteres


Este C (compilable con gcc v4.3.4):

#include <stdio.h>
main(){char *c="#include <stdio.h>%cmain(){char *c=%c%s%c;printf(c,10,34,c,34);}";printf(c,10,34,c,34);}

genera este (idéntico) C ++ (compilable con g ++ 4.3.4, una advertencia):

#include <stdio.h>
main(){char *c="#include <stdio.h>%cmain(){char *c=%c%s%c;printf(c,10,34,c,34);}";printf(c,10,34,c,34);}

Esto está dentro de las reglas publicadas. : P Y, como Ventero, esto se basa en la respuesta de JB .

Matthew Read
fuente
1
OK, entonces estaba dentro de las reglas publicadas hasta la edición diciendo que las fuentes no pueden ser las mismas. Un cambio menor podría arreglar eso, pero no estoy dispuesto a alentar ediciones tan tardías.
Matthew leyó el
9

Java a Python - 219

Java:

class Q{public static void main(String[]a){char q=34,c=39;String s="print%sclass Q{public static void main(String[]a){char q=34,c=39;String s=%s%s%s;System.out.printf(s,c,q,s,q,c);}}%s";System.out.printf(s,c,q,s,q,c);}}

Pitón:

print'class Q{public static void main(String[]a){char q=34,c=39;String s="print%sclass Q{public static void main(String[]a){char q=34,c=39;String s=%s%s%s;System.out.printf(s,c,q,s,q,c);}}%s";System.out.printf(s,c,q,s,q,c);}}'

Hace uso del hecho de que Python permite 'cadenas; esto hace que sea mucho más fácil escribir la fuente del programa java en el programa python.

Justin
fuente
3
+1 por hacer el trabajo sucio en el peor idioma de golf. : P
cjfaure
8

Python + Piet one-liners: 417 caracteres + 7391 7107 ejecutando codeles

Este script de Python produce una imagen de 7393 x 2; el bloque 2x2 más a la derecha del cual es un "centinela" que termina el programa; así que no estoy contando esos; y la segunda fila es de otro modo blanca. Probablemente pueda seguir desarrollando el código piet usando cadenas de suma / resta / multiplicación en lugar del ingenuo algoritmo binario ... pero no quiero dar una solución a un rompecabezas futuro.

No voy a publicar la imagen aquí, debido a sus dimensiones ridículas. Si desea verlo, ejecute el código de Python y canalice la salida a un archivo .ppm. Luego, convierta el .ppm a .gif, y ejecute la salida en Rapapaing . (alternativamente, use un intérprete de Piet que no sea web y que asimile .ppm)

A='P=lambda A:reduce(lambda(D,H,B),P:(D[P/3:]+D[:P/3],H[P%3*2:]+H[:P%3*2],B+"".join("%i "%H[(D[0]/P)%2]for P in[1,2,4])),map(" A !        @    B".find,A),([1,3,2,6,4,5],[0,192,192,255,0,255],"P3 %i 2 255 "%(len(A)+2)))[2]+"255 "*4+"0 0 "+"255 "*len(A)*3+"255 0 0 "*2;B=lambda D:["@!%s","@@!%s!"][D%2]%B(D/2)if 1<D else"";print P("".join("A%sB"%B(ord(D))for D in"A=%s;exec A[:-13]"%`A`)+" ");exec A[:-13]';exec A[:-13]

editar: jugó un poco el piet al reducir el peso de Hamming de los nombres de variables.

menos golf pre-quine :

Esta es una versión anterior, antes de darme cuenta de que podía convertirla en una frase. Es marginalmente más fácil de entender. La función P traduce un conjunto de instrucciones especiales en Piet; y la función p toma un número entero y produce una secuencia de instrucciones para crear ese número entero en la pila. Solo estoy usando las instrucciones =,+,:,|, por lo que esto probablemente podría hacerse más eficiente ... pero me gusta tener un compilador Piet completo (de algún tipo) en la fuente.

s="""def P(s):
 l=len(s)+1;R="P3 %i 2 255 "%(l+2);C=[1,3,2,6,4,5];V=[0,192,192,255,0,255]
 for x in map("=|^+-*/%~>.,:@$?#!".find,"="+s):
  C=C[x//3:]+C[:x//3];V=V[x%3*2:]+V[:x%3*2]
  for i in [1,2,4]:R+="%i "%V[(C[0]//i)%2]
 return R+"255 "*4+"0 0 "+"255 "*l*3+"255 0 0 "*2
p=lambda x:[":+%s","::+%s+"][x%2]%p(x/2)if x/2 else""
print P("".join("|%s!"%k(ord(c))for c in "s="+`s`+";exec s[:-13]"))
exec s[:-13]"""
exec s[:-13]
boothby
fuente
Piet Creator es un IDE de Piet mucho más agradable (y mucho menos defectuoso). Escrito por un usuario de este sitio , por cierto :)
Joey
He usado Piet Creator antes; Es una gran herramienta. Rapapaing es bueno para las personas que son flojas, como yo, y no quieren molestarse. FWIW, usaría Piet Creator si lo ejecutó a través de github.com/kripken/emscripten/wiki , y lo puso en su página.
stand el
Ni siquiera pude obtener la versión Qt para compilar aquí;)
Joey
;) Gracias por intentarlo, de todos modos. Te escribí un comprobador de fuzz: codegolf.stackexchange.com/questions/2922/…
boothby el
Bueno, podrías meter a Casey en el chat y señalarlo ;-)
Joey
5

/Brainf..k/, 6988 bytes

Brainfuck

++++++++++>>>+>>>++++++++++>>>+++++++++++>>>++++++>>>+++++++>>>++>>>++++++>>>+++++++>>>+++++++++++>>>++++++>>>+++++++>>>++++++++++>>>+>>>++++++++>>>+>>>++++++++++>>>+++++++++++>>>++>>>+++++++++>>>+>>>++>>>++++++>>>+>>>+>>>+>>>+>>>+>>>++>>>+>>>++>>>+>>>++>>>+>>>++>>>+>>>++>>>++>>>++++++++++>>>+++++++++++>>>++>>>++++++++++>>>+++++++++++>>>++>>>++++++++++>>>+++++++++++>>>++>>>+++++++>>>++>>>++++++++++>>>+>>>++++++++++>>>+++++++++++>>>+>>>++>>>++++++>>>+>>>++++++++++>>>+++++++++++>>>+>>>++>>>++>>>+++++++>>>++>>>++++++++++>>>+>>>++++++++++>>>+++++++++++>>>+>>>++>>>++++++>>>+>>>++++++++++>>>+++++++++++>>>+>>>++>>>+>>>++>>>++>>>+++++++>>>++>>>++++++++++>>>+>>>++++++++++>>>+++++++++++>>>+>>>++>>>++++++>>>+>>>++++++++++>>>+++++++++++>>>+>>>++>>>+>>>++>>>++>>>+++++++>>>++>>>++++++++++>>>+>>>++++++++++>>>+++++++++++>>>+>>>++>>>++++++>>>+>>>++++++++++>>>+++++++++++>>>+>>>++>>>++>>>+++++++>>>++>>>++++++++++>>>+>>>++++++++++>>>+++++++++++>>>+>>>++>>>++++++>>>+>>>++++++++++>>>+++++++++++>>>+>>>+>>>+>>>++>>>+>>>++>>>+>>>++>>>++>>>++++++++++>>>+++++++++++>>>+>>>++>>>++>>>++++++++++>>>+++++++++++>>>++>>>+++++++>>>++>>>++++++++++>>>+>>>++++++++++>>>+++++++++++>>>+>>>++>>>++++++>>>+>>>++++++++++>>>+++++++++++>>>+>>>++>>>+>>>++>>>++>>>+++++++>>>++>>>++++++++++>>>+>>>++++++++++>>>+++++++++++>>>+>>>++>>>++++++>>>+>>>++++++++++>>>+++++++++++>>>+>>>+>>>+>>>+>>>++>>>+>>>++>>>+>>>++>>>++>>>++++++++++>>>+++++++++++>>>+>>>++>>>++>>>++++++++++>>>+++++++++++>>>++>>>++++++++++>>>+++++++++++>>>+>>>++>>>++>>>+++++++>>>++>>>++++++++++>>>+>>>++++++++++>>>+++++++++++>>>+>>>++>>>++++++>>>+>>>++++++++++>>>+++++++++++>>>+>>>++>>>+>>>++>>>++>>>+++++++>>>++>>>++++++++++>>>+>>>++++++++++>>>+++++++++++>>>+>>>++>>>++++++>>>+>>>++++++++++>>>+++++++++++>>>+>>>+>>>+>>>+>>>++>>>+>>>++>>>+>>>++>>>+>>>++>>>+>>>++>>>++>>>++>>>++++++++++>>>+++++++++++>>>++++++++++>>>+++++++++++>>>++>>>++++++++++>>>+++++++++++>>>++>>>+++++++>>>++>>>++++++++++>>>+>>>++++++>>>++++++++++>>>+++++++++++>>>+>>>++++++++++>>>+++++++++++>>>+>>>++>>>+>>>++>>>++>>>+++++++>>>++>>>+++++++++++>>>+++++++++++>>>+++++++++++>>>+++++++++++>>>+++++++++++>>>+++++++++++>>>+++++++++++>>>+++++++++++>>>+++++++++++>>>+++++++++++>>>++++++++++>>>+++++++++++>>>+>>>++++++++++>>>+++++++++++>>>++++++>>>+>>>++++++>>>+++++++>>>++>>>++++++>>>+++++++>>>++++++++++>>>+>>>++++++++++>>>+++++++++++>>>++++++>>>+++++++>>>++>>>++++++>>>+++++++>>>+++++++++++>>>++++++++++>>>+++++++++++>>>+++++++>>>++>>>+>>>++++++>>>+++++++>>>++++++>>>+++++++>>>++>>>++++++>>>+++++++>>>++++++++++>>>+>>>++++++++++>>>+++++++++++>>>++++++>>>+++++++>>>++>>>++++++>>>+++++++>>>+++++++++++>>>++++++++++>>>+++++++++++>>>++++++>>>+++++++>>>++++++++++>>>+>>>++++++++++>>>+++++++++++>>>++++++++>>>+>>>++>>>+++++++++>>>++>>>++++++>>>+++++++>>>+>>>+>>>+>>>+>>>+>>>+>>>++>>>+>>>++>>>+>>>++>>>++>>>++++++++++>>>+++++++++++>>>+>>>++>>>++>>>++>>>++++++++++>>>+++++++++++>>>++++++++++>>>+++++++++++>>>++>>>++++++++++>>>+++++++++++>>>+>>>++>>>++>>>++++++>>>+++++++>>>+++++++++++>>>++++++++++>>>+++++++++++>>>++++++>>>+++++++>>>+>>>+>>>+>>>+>>>++++++++++>>>+++++++++++>>>++>>>+>>>+>>>+>>>+>>>++>>>+>>>++>>>+>>>++>>>++>>>++>>>++++++++++>>>+++++++++++>>>++++++++++>>>+++++++++++>>>++>>>++++++++++>>>+++++++++++>>>+>>>++>>>++>>>++>>>++>>>++++++>>>+++++++>>>+++++++++++>>>++++++++++>>>+++++++++++>>>+>>>++++++++>>>+++++++++>>>++>>>++++++++++>>>+>>>+>>>+>>>++++++++++>>>+++++++++++>>>++++++++>>>+>>>++>>>+++++++++>>>++>>>++++++>>>++++++++++>>>+>>>++++++++++>>>+++++++++++>>>++++++++>>>+>>>++>>>+++++++++>>>++++++>>>+>>>++++++++++>>>+++++++++++>>>++++++>>>+>>>++++++++++>>>+++++++++++>>>++++++>>>+++++++>>>++>>>++++++>>>+++++++>>>+++++++>>>++>>>+++++++>>>++>>>+++++++++++>>>++++++++++>>>+++++++++++>>>+++++++>>>++>>>++++++>>>++++++++++>>>+>>>++++++++++>>>+++++++++++>>>++++++++>>>+>>>++>>>+++++++++>>>++++++>>>++++++>>>+++++++>>>+>>>++++++++++>>>+++++++++++>>>++++++>>>+++++++>>>++>>>+++++++>>>++>>>+++++++++++>>>++++++++++>>>+++++++++++>>>+++++++>>>++>>>+++++++++++>>>++++++++++>>>+++++++++++>>>++++++++++>>>++++++>>>+++++++>>>+>>>++++++++++>>>+++++++++++>>>++++++>>>+++++++>>>++>>>+++++++++++>>>++++++++++>>>+++++++++++>>>+>>>++++++>>>+++++++>>>++>>>++++++++++>>>++++++>>>++++++>>>++++++>>>++++++++>>>++++++>>>++++++>>>++++++>>>+++++++++>>>+++++++>>>+++++++>>>+++++++>>>++++++++>>>+++++++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++++>>>++++++>>>++++++++>>>++++>>>+++++++>>>+++++>>>+++>>>+++++>>>++++>>>+++++++>>>+++>>>++++++>>>++++++>>>+++++++++>>>+++++++>>>+++>>>+++++>>>++++++++>>>++++>>>+++++++++>>>+++++++>>>+++++++>>>+++++++++>>>++++++>>>++++++++>>>++++++>>>++++++>>>++++++>>>+++++++++>>>+++++++>>>+++++++>>>+++++++>>>++++++++>>>++++++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++++++>>>++++>>>++++++++>>>++++++>>>+++>>>+++++++>>>++++>>>++++++++>>>++++++>>>+++>>>+++>>>+++++++>>>++++>>>++++++++>>>++++++>>>+++>>>+++>>>+++++++>>>++++>>>++++++++>>>++++++>>>+++>>>+++++++>>>++++>>>++++++++>>>++++++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++++++>>>++++>>>++++++++>>>++++++>>>+++>>>+++>>>+++++++>>>++++>>>++++++++>>>++++++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++++++>>>++++>>>++++++++>>>++++++>>>+++>>>+++>>>+++++++>>>++++>>>++++++++>>>++++++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++>>>+++++++>>>++++>>>++++++++>>>++++++>>>+++>>>+++>>>+++++++>>>++++>>>+++++++++>>>+++++++++>>>+++++++++>>>+++++++++>>>+++++++++>>>+++++++++>>>+++++++++>>>+++++++++>>>+++++++++>>>+++++++++>>>++++++>>>+++++>>>+++++++>>>+++++++>>>+++++++>>>+++++++>>>+++++++++>>>+++++++++++>>>++++++++++>>>+++++++++++>>>++++++>>>+++++++>>>{({}<>)<>}<>{([({})]()<((((()()()()()){}){}){})>){({}()<({}())>){({}()<({}()())>){({}()<({}()())>){({}()<({}())>){({}()<({}((()()()){}()){})>){({}()<({}()())>){({}()<({}(((()()()){}()){}){}())>){({}()<({}()())>){({}()<({}(((()()()()())){}{}){})>){(<{}({}()())>)}}}}}}}}}}{}({}<(<>)<>{({}<>)<>}{}>)(<><>)<>{({}<>)<>}{}<>{({}[()])<>(((((()()()){}())){}{}){}())<>}{}<>(((({})(((()()())){}{}){}())))<>}{}([]){((({}[()])<{({}[()]<({}<({}<>)<>>)>)}{}>)<{({}[()]<<>({}<>)>)}{}>)}{}{<>({}<>)}{}(<>){<<<[<<<]>>>[>++++++++++++++++++++++++++++++++++++++++.<[->.+.->+<<]>+.[-]>>]<[<<<]>>>[<++++++++++++++++++++++++++++++++++++++++>-[<+>-[<++>-[<++>-[<+>-[<++++++++++++++>-[<++>-[<+++++++++++++++++++++++++++++>-[<++>-[<++++++++++++++++++++++++++++++>-[<++>-]]]]]]]]]]<.>>>>]}{}<>

Pruébalo en línea!

Brain-Flak

(()()()()()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(()()()()()())(()()()()()()())(()())(()()()()()())(()()()()()()())(()()()()()()()()()()())(()()()()()())(()()()()()()())(()()()()()()()()()())(())(()()()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(()())(()()()()()()()()())(())(()())(()()()()()())(())(())(())(())(())(()())(())(()())(())(()())(())(()())(())(()())(()())(()()()()()()()()()())(()()()()()()()()()()())(()())(()()()()()()()()()())(()()()()()()()()()()())(()())(()()()()()()()()()())(()()()()()()()()()()())(()())(()()()()()()())(()())(()()()()()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(())(()())(()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(())(()())(()())(()()()()()()())(()())(()()()()()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(())(()())(()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(())(()())(())(()())(()())(()()()()()()())(()())(()()()()()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(())(()())(()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(())(()())(())(()())(()())(()()()()()()())(()())(()()()()()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(())(()())(()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(())(()())(()())(()()()()()()())(()())(()()()()()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(())(()())(()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(())(())(())(()())(())(()())(())(()())(()())(()()()()()()()()()())(()()()()()()()()()()())(())(()())(()())(()()()()()()()()()())(()()()()()()()()()()())(()())(()()()()()()())(()())(()()()()()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(())(()())(()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(())(()())(())(()())(()())(()()()()()()())(()())(()()()()()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(())(()())(()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(())(())(())(())(()())(())(()())(())(()())(()())(()()()()()()()()()())(()()()()()()()()()()())(())(()())(()())(()()()()()()()()()())(()()()()()()()()()()())(()())(()()()()()()()()()())(()()()()()()()()()()())(())(()())(()())(()()()()()()())(()())(()()()()()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(())(()())(()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(())(()())(())(()())(()())(()()()()()()())(()())(()()()()()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(())(()())(()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(())(())(())(())(()())(())(()())(())(()())(())(()())(())(()())(()())(()())(()()()()()()()()()())(()()()()()()()()()()())(()()()()()()()()()())(()()()()()()()()()()())(()())(()()()()()()()()()())(()()()()()()()()()()())(()())(()()()()()()())(()())(()()()()()()()()()())(())(()()()()()())(()()()()()()()()()())(()()()()()()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(())(()())(())(()())(()())(()()()()()()())(()())(()()()()()()()()()()())(()()()()()()()()()()())(()()()()()()()()()()())(()()()()()()()()()()())(()()()()()()()()()()())(()()()()()()()()()()())(()()()()()()()()()()())(()()()()()()()()()()())(()()()()()()()()()()())(()()()()()()()()()()())(()()()()()()()()()())(()()()()()()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(()()()()()())(())(()()()()()())(()()()()()()())(()())(()()()()()())(()()()()()()())(()()()()()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(()()()()()())(()()()()()()())(()())(()()()()()())(()()()()()()())(()()()()()()()()()()())(()()()()()()()()()())(()()()()()()()()()()())(()()()()()()())(()())(())(()()()()()())(()()()()()()())(()()()()()())(()()()()()()())(()())(()()()()()())(()()()()()()())(()()()()()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(()()()()()())(()()()()()()())(()())(()()()()()())(()()()()()()())(()()()()()()()()()()())(()()()()()()()()()())(()()()()()()()()()()())(()()()()()())(()()()()()()())(()()()()()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(()()()()()()()())(())(()())(()()()()()()()()())(()())(()()()()()())(()()()()()()())(())(())(())(())(())(())(()())(())(()())(())(()())(()())(()()()()()()()()()())(()()()()()()()()()()())(())(()())(()())(()())(()()()()()()()()()())(()()()()()()()()()()())(()()()()()()()()()())(()()()()()()()()()()())(()())(()()()()()()()()()())(()()()()()()()()()()())(())(()())(()())(()()()()()())(()()()()()()())(()()()()()()()()()()())(()()()()()()()()()())(()()()()()()()()()()())(()()()()()())(()()()()()()())(())(())(())(())(()()()()()()()()()())(()()()()()()()()()()())(()())(())(())(())(())(()())(())(()())(())(()())(()())(()())(()()()()()()()()()())(()()()()()()()()()()())(()()()()()()()()()())(()()()()()()()()()()())(()())(()()()()()()()()()())(()()()()()()()()()()())(())(()())(()())(()())(()())(()()()()()())(()()()()()()())(()()()()()()()()()()())(()()()()()()()()()())(()()()()()()()()()()())(())(()()()()()()()())(()()()()()()()()())(()())(()()()()()()()()()())(())(())(())(()()()()()()()()()())(()()()()()()()()()()())(()()()()()()()())(())(()())(()()()()()()()()())(()())(()()()()()())(()()()()()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(()()()()()()()())(())(()())(()()()()()()()()())(()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(()()()()()())(()()()()()()())(()())(()()()()()())(()()()()()()())(()()()()()()())(()())(()()()()()()())(()())(()()()()()()()()()()())(()()()()()()()()()())(()()()()()()()()()()())(()()()()()()())(()())(()()()()()())(()()()()()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(()()()()()()()())(())(()())(()()()()()()()()())(()()()()()())(()()()()()())(()()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(()()()()()())(()()()()()()())(()())(()()()()()()())(()())(()()()()()()()()()()())(()()()()()()()()()())(()()()()()()()()()()())(()()()()()()())(()())(()()()()()()()()()()())(()()()()()()()()()())(()()()()()()()()()()())(()()()()()()()()()())(()()()()()())(()()()()()()())(())(()()()()()()()()()())(()()()()()()()()()()())(()()()()()())(()()()()()()())(()())(()()()()()()()()()()())(()()()()()()()()()())(()()()()()()()()()()())(())(()()()()()())(()()()()()()())(()())(()()()()()()()()()())(()()()()()())(()()()()()())(()()()()()())(()()()()()()()())(()()()()()())(()()()()()())(()()()()()())(()()()()()()()()())(()()()()()()())(()()()()()()())(()()()()()()())(()()()()()()()())(()()()()()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()()()())(()()()()()())(()()()()()()()())(()()()())(()()()()()()())(()()()()())(()()())(()()()()())(()()()())(()()()()()()())(()()())(()()()()()())(()()()()()())(()()()()()()()()())(()()()()()()())(()()())(()()()()())(()()()()()()()())(()()()())(()()()()()()()()())(()()()()()()())(()()()()()()())(()()()()()()()()())(()()()()()())(()()()()()()()())(()()()()()())(()()()()()())(()()()()()())(()()()()()()()()())(()()()()()()())(()()()()()()())(()()()()()()())(()()()()()()()())(()()()()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()()()()()())(()()()())(()()()()()()()())(()()()()()())(()()())(()()()()()()())(()()()())(()()()()()()()())(()()()()()())(()()())(()()())(()()()()()()())(()()()())(()()()()()()()())(()()()()()())(()()())(()()())(()()()()()()())(()()()())(()()()()()()()())(()()()()()())(()()())(()()()()()()())(()()()())(()()()()()()()())(()()()()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()()()()()())(()()()())(()()()()()()()())(()()()()()())(()()())(()()())(()()()()()()())(()()()())(()()()()()()()())(()()()()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()()()()()())(()()()())(()()()()()()()())(()()()()()())(()()())(()()())(()()()()()()())(()()()())(()()()()()()()())(()()()()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()()()()()())(()()()())(()()()()()()()())(()()()()()())(()()())(()()())(()()()()()()())(()()()())(()()()()()()()()())(()()()()()()()()())(()()()()()()()()())(()()()()()()()()())(()()()()()()()()())(()()()()()()()()())(()()()()()()()()())(()()()()()()()()())(()()()()()()()()())(()()()()()()()()())(()()()()()())(()()()()())(()()()()()()())(()()()()()()())(()()()()()()())(()()()()()()())(()()()()()()()()())(()()()()()()()()()()())(()()()()()()()()()())(()()()()()()()()()()())(()()()()()())(()()()()()()()){({}<>)<>}<>{([({})]()<((((()()()()()){}){}){})>){({}()<({}())>){({}()<({}()())>){({}()<({}()())>){({}()<({}())>){({}()<({}((()()()){}()){})>){({}()<({}()())>){({}()<({}(((()()()){}()){}){}())>){({}()<({}()())>){({}()<({}(((()()()()())){}{}){})>){(<{}({}()())>)}}}}}}}}}}{}({}<(<>)<>{({}<>)<>}{}>)(<><>)<>{({}<>)<>}{}<>{({}[()])<>(((((()()()){}())){}{}){}())<>}{}<>(((({})(((()()())){}{}){}())))<>}{}([]){((({}[()])<{({}[()]<({}<({}<>)<>>)>)}{}>)<{({}[()]<<>({}<>)>)}{}>)}{}{<>({}<>)}{}(<>){<<<[<<<]>>>[>++++++++++++++++++++++++++++++++++++++++.<[->.+.->+<<]>+.[-]>>]<[<<<]>>>[<++++++++++++++++++++++++++++++++++++++++>-[<+>-[<++>-[<++>-[<+>-[<++++++++++++++>-[<++>-[<+++++++++++++++++++++++++++++>-[<++>-[<++++++++++++++++++++++++++++++>-[<++>-]]]]]]]]]]<.>>>>]}{}<>

Pruébalo en línea!

Brain-Flak podría pasar el tiempo en TIO.

Explicación

Próximamente.

Asistente de trigo
fuente
Ese políglota al final es bastante impresionante ...
ETHproductions
1
Explanation coming soon->Jan 27
MD XF
4

Ruby y Python (393 + 413 = 806 caracteres)

Ligero cambio de esta respuesta mía. Definitivamente podría reducirse ya que simplemente codifiqué la entrada sin ninguna optimización.

Rubí (393 caracteres)

require 'json';s=%q[{"ruby":[" %q[","require 'json';s=##;j=JSON.load s;puts j[l='python'][1].sub('##',j[l][0].delete(' ')+s+j[l][2].delete(' '))"," ]"],"python":["' ''","import json,re;s=##;j=json.loads(s);l='ruby';print(re.sub('##',j[l][0].replace(' ','')+s+j[l][2].replace(' ',''),j[l][1],1))","' ''"]}];j=JSON.load s;puts j[l='python'][1].sub('##',j[l][0].delete(' ')+s+j[l][2].delete(' '))

Python (413 caracteres)

import json,re;s='''{"ruby":[" %q[","require 'json';s=##;j=JSON.load s;puts j[l='python'][1].sub('##',j[l][0].delete(' ')+s+j[l][2].delete(' '))"," ]"],"python":["' ''","import json,re;s=##;j=json.loads(s);l='ruby';print(re.sub('##',j[l][0].replace(' ','')+s+j[l][2].replace(' ',''),j[l][1],1))","' ''"]}''';j=json.loads(s);l='ruby';print(re.sub('##',j[l][0].replace(' ','')+s+j[l][2].replace(' ',''),j[l][1],1))
Nemo157
fuente
3

Python 2 a Befunge 98, 94 78

Nuevamente, haciendo uso de las dos formas de hacer cuerdas de Python:

Pitón:

s='<@,kM%c%cs=%c%s%c;print s%%(39,34,39,s,39,34)%c';print s%(39,34,39,s,39,34)

Befunge 98:

<@,kM'"s='<@,kM%c%cs=%c%s%c;print s%%(39,34,39,s,39,34)%c';print s%(39,34,39,s,39,34)"

El programa python formatea la cadena para que se incluya a sí mismo y a los caracteres para la comilla simple y doble.

El programa Befunge funciona así:

  • <: mover hacia la izquierda y envolver. Entonces ahora ejecutamos los comandos de derecha a izquierda
  • ": haz que cada personaje que encontremos sea empujado a la pila hasta que encontremos otro ", así que empujamos:

    )43,93,s,93,43,93(%s tnirp;'c%)43,93,s,93,43,93(%%s tnirp;c%s%c%=sc%c%Mk,@<'=s
    

    Que en realidad es solo el programa Python, invertido debido a la forma en que Befunge imprime (que es un bucle pop + print)

  • 'M: empujar Ma la pila. Mtambién es el número 77, que es uno menos que el número de caracteres empujados a la pila por el "s.
  • k: saca el valor superior de la pila ( M) y realiza la siguiente operación muchas veces, más una.
  • ,: saca el valor superior de la pila e imprime el carácter.
  • @: finaliza el programa.
Justin
fuente
Buen dolor, y en un lenguaje esotérico notoriamente difícil también. Eso es ... aterrador.
Shayne
2

Subcarga y Betaload , 16 bytes (no competitivos)

Subcarga:

(a(:^)*a(S)*S):^

Betaload:

((a(:^)*a(S)*S):^)S

Betaload es un superconjunto de Underload, por lo que podrían ser dos respuestas de Underload.

Esto no es competitivo porque Betaload se creó después de publicar este desafío.

Fruta Esolanging
fuente
1

Clipper y C (111 + 108 = 219 caracteres)

Clipper (111)

?'char*f="%c%cchar*f=%c%s%c;main(){printf(f,63,39,34,f,34,39,10);}%c%c";main(){printf(f,63,39,34,f,34,39,10);}'

C (108)

char*f="%c%cchar*f=%c%s%c;main(){printf(f,63,39,34,f,34,39,10);}%c%c";main(){printf(f,63,39,34,f,34,39,10);}

Esto es un poco una evasión porque:

  1. el comando "imprimir" en Clipper es realmente simple: ?'foo':-)
  2. Lo basé en la quine "clásica C" de http://www.nyx.net/~gthompso/quine.htm , con algunas modificaciones para exprimir los ?y 's.
  3. No lo hice #include <stdio.h>, por lo que da una advertencia del compilador
  4. La salida del código C de la versión Clipper tuvo que ser presionada para eliminar un salto de línea introducido por un límite de columna de 80 caracteres en mi terminal o en la rutina de impresión de Harbour o algo así.
marnir
fuente
Bueno, el PRINTcomando BÁSICO también podría abreviarse ?:-)
Joey
0

Python y ~ - ~! - 77 y 81 = 158

Este código de Python:

q=chr(124);s='@%sq=chr(124);s=%s;print(s%%repr(s))%s:';print(s%(q,repr(s),q))

genera esto ~ - ~! código:

@|q=chr(124);s='@%sq=chr(124);s=%s;print(s%%repr(s))%s:';print(s%(q,repr(s),q))|:

Definitivamente se puede mejorar mucho, y adopta un montón de las otras respuestas.

cjfaure
fuente
0

Javascript y Windows .bat (71 y 81)

f=()=>{console.log('echo f='+(f+';f()').replace(/(?=[>^\\])/g,'^'))};f()

y

echo f=()=^>{console.log('echo f='+(f+';f()').replace(/(?=[^>^^^\^\])/g,'^^'))};f()
aaay aaay
fuente