Senter for Marxistiske og Matematiske Studium, Enschede (SMMSE)

15 juli 2008

 

To quines

Berre for moro skuld. To quines skrivne i Java.

public class Quine {
public static void main(String[] args) {
String s = "public class Quine {%n public static void main(String[] args) {%n String s = %2$c%1$s%2$c;%n System.out.printf(s, s, 34);%n }%n}";
System.out.printf(s, s, 34);
}
}


public class Q {
static byte[] c = {112,117,98,108,105,99,32,99,108,97,115,115,32,81,32,123,
10,32,32,32,32,115,116,97,116,105,99,32,98,121,116,101,
91,93,32,99,32,61,32,123,125,59,10,10,32,32,32,32,
112,117,98,108,105,99,32,115,116,97,116,105,99,32,118,111,
105,100,32,109,97,105,110,40,83,116,114,105,110,103,91,93,
32,97,114,103,115,41,32,123,10,32,32,32,32,32,32,32,
32,102,111,114,32,40,105,110,116,32,105,61,48,59,105,60,
52,48,59,105,43,43,41,32,83,121,115,116,101,109,46,111,
117,116,46,112,114,105,110,116,40,40,99,104,97,114,41,32,
99,91,105,93,41,59,10,32,32,32,32,32,32,32,32,102,
111,114,32,40,105,110,116,32,105,61,48,59,105,60,99,46,
108,101,110,103,116,104,59,105,43,43,41,32,123,10,32,32,
32,32,32,32,32,32,32,32,32,32,83,121,115,116,101,109,
46,111,117,116,46,112,114,105,110,116,40,99,91,105,93,41,
59,10,32,32,32,32,32,32,32,32,32,32,32,32,105,102,
32,40,105,33,61,99,46,108,101,110,103,116,104,45,49,41,
32,83,121,115,116,101,109,46,111,117,116,46,112,114,105,110,
116,40,34,44,34,41,59,10,32,32,32,32,32,32,32,32,
32,32,32,32,105,102,32,40,40,105,43,49,41,37,49,54,
61,61,48,41,32,83,121,115,116,101,109,46,111,117,116,46,
112,114,105,110,116,40,34,92,110,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
34,41,59,10,32,32,32,32,32,32,32,32,125,10,32,32,
32,32,32,32,32,32,102,111,114,32,40,105,110,116,32,105,
61,52,48,59,105,60,99,46,108,101,110,103,116,104,59,105,
43,43,41,32,83,121,115,116,101,109,46,111,117,116,46,112,
114,105,110,116,40,40,99,104,97,114,41,32,99,91,105,93,
41,59,10,32,32,32,32,125,10,125};

public static void main(String[] args) {
for (int i=0;i<40;i++) System.out.print((char) c[i]);
for (int i=0;i<c.length;i++) {
System.out.print(c[i]);
if (i!=c.length-1) System.out.print(",");
if ((i+1)%16==0) System.out.print("\n ");
}
for (int i=40;i<c.length;i++) System.out.print((char) c[i]);
}
}

Kommentarar: Legg inn en kommentar



<< Framside

Tidlegare tekstar

Brev frå Schickard til Kepler
Rapport: Hjelper valkamp?
Prosjektskildring: Hjelper valkamp?
Operativsystemrevolusjonen
Perspektiv på fri/open programvare
Om ... misforståingar knytt til datateknologi II
Om misoppfatninga at fri/open programvare er kommu...
Til glede for nye brukarar
Jevons sitt logikkpiano IV – simulatoren
Samarbeid, fridom, openheit

Arkiv

november 2005   desember 2005   februar 2006   april 2006   november 2006   desember 2006   januar 2007   februar 2007   mars 2007   august 2007   desember 2007   januar 2008   juli 2008  

This page is powered by Blogger. Isn't yours?