Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestions #7

Open
xem opened this issue Feb 15, 2017 · 11 comments
Open

Suggestions #7

xem opened this issue Feb 15, 2017 · 11 comments

Comments

@xem
Copy link

xem commented Feb 15, 2017

Hi,
Great list!
You can find a list of all our tiny JS projects here: https://gist.github.com/xem/206db44adbdd09bac424
Feel free to cite any of them (or not) in your collection.
Cheers,
The codegolf team

@xem
Copy link
Author

xem commented Feb 15, 2017

also: https://github.com/mame/quine-relay

@MinhasKamal
Copy link
Owner

Many many thanks for your suggestion. I will certainly browse through them. :)

@aemkei
Copy link
Contributor

aemkei commented Feb 16, 2017

👍

@ghost
Copy link

ghost commented Feb 16, 2017

I used to play around with RLE stuff, so I created the beneath code and have saved it as pipe.c, but it's obvious that this isn't a pipe (Ce n'est pas une pipe).
Feel free to add this to your collection.

#include <stdio.h>
#define J(x) "+=:~,*"[x]
#define P 255
#define Q ((P)-1)
int main(void) {
int i=0,j=0,c,l;char d[297];const char *u=
" bool is_pipe(void) { *+* return false; *+* } *+*+\0\x1b[01m\0\x1b[00m";
const unsigned char n[]={253,79,P,10,Q,68,P,1,2,1,2,4,1,3,1,1,Q,37,P,9,1,2,Q,12,
P,2,1,2,2,4,1,1,6,Q,29,P,1,3,14,3,Q,11,P,2,1,2,2,7,5,1,Q,24,P,3,1,3,1,2,2,6,1,1,
2,2,Q,12,P,2,1,2,2,7,5,1,Q,21,P,1,1,1,3,1,1,2,3,1,1,Q,24,P,1,1,3,2,7,5,1,Q,19,P,
2,1,3,1,3,1,2,Q,27,P,1,2,3,2,7,5,1,Q,17,P,1,1,4,1,2,2,2,Q,29,P,1,1,1,3,2,6,6,1,
Q,14,P,2,1,4,1,6,Q,31,P,1,1,1,3,2,6,6,1,Q,12,P,2,2,2,1,4,1,2,Q,34,P,1,1,3,2,6,6,
1,Q,10,P,2,2,2,1,3,4,1,Q,35,P,2,1,2,2,6,6,1,Q,8,P,2,3,2,1,2,5,Q,37,P,2,1,2,2,6,
6,1,Q,5,P,2,3,2,2,2,5,1,Q,38,P,2,5,6,7,4,3,3,2,2,6,Q,40,P,3,4,5,8,5,2,2,3,6,1,Q,
42,P,2,4,5,7,1,6,4,7,Q,44,P,10,10,4,9,1,Q,47,P,7,24,1,Q,49,P,1,27,Q,54,P,6,1,2,
1,13,1,Q,58,P,1,17,1,Q,14,24,28,P,1,4,1,1,1,Q,20,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,56,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,4,1,56,1,1,1,20,1,56,24,89,Q,
},a[]={0,16,16,50,49,1,48,35,32,49,1,50,50,3,35,32,49,1,50,16,33,1,50,66,19,32,
49,1,50,48,50,48,19,36,36,3,16,19,35,2,16,50,66,1,48,19,35,3,16,50,66,1,49,1,50,
48,49,1,32,19,16,19,35,3,16,19,66,3,16,19,35,3,16,19,33,3,16,19,35,3,16,19,32,
49,1,50,48,49,1,50,48,49,50,49,1,50,3,19,33,1,50,48,49,50,49,50,3,35,35,3,33,3,
32,36,36,35,3,33,5,3,35,35,5,P,};
for(;a[i]!=P;i++){d[j++]=J(a[i]>>4);d[j++]=J(a[i]&15);}
for(i=0;u[i];i++)d[j++]=u[i];
for(i=c=l=0;i<(int)(sizeof(n)/sizeof(*(n)))&&c<(int)(sizeof(d));i++){
if(n[i]>=Q){fputs(u+51+(n[i]!=P?6:0),stdout);continue;}
for(j=0;j<n[i];j++){putchar(d[c]);if(!(++l%80))putchar('\n');}c++;}
return 0; // by mar77i, all rights and warranties disclaimed
}

@pavelkryukov
Copy link

I wanted to suggest the Haskell code which prints Ruby script which prints Python script which prints initial Haskell code... but then I looked into quine-relay above...

Nevertheless, here it is, I don't remember where I found it:

q a b c=putStrLn $ b ++ [toEnum 10,'q','(']
  ++ show b ++ [','] ++ show c ++ [','] ++ show a ++ [')']
main=q "q a b c=putStrLn $ b ++ [toEnum 10,'q','('] ++ show b ++ [','] ++ show c ++ [','] ++ show a ++ [')']"
  "def q(a,b,c):print b+chr(10)+'q('+repr(b)+','+repr(c)+','+repr(a)+')'" 
  "def e(x) return 34.chr+x+34.chr end;def q(a,b,c) print b+10.chr+'main=q '+e(b)+' '+e(c)+' '+e(a)+' '+10.chr end"

@pavelkryukov
Copy link

Calculate Easter date in Excel:

http://www.contextures.com/exceleastercalculation.html

The winner was apparently Norbert Hetterich of Germany with this formula (assumes the year is in cell A1, and day/month/year date format in regional settings)
=FLOOR(DAY(MINUTE(A1/38)/2+56)&"/5/"&A1,7)-34

@igorwwwwwwwwwwwwwwwwwwww

a stack machine based only on the word chicken http://torso.me/chicken

@PeterWCox
Copy link

I know its not common practice to do this, but just wanted to say thank for such a cool repository. Found it when coming across your https://downgit.github.io/#/home?url=https:%2F%2Fgithub.com%2Fpnp%2Fsp-dev-fx-webparts%2Ftree%2Fmain%2Fsamples%2Freact-custompropertypanecontrols tool.

@houmy555809
Copy link

houmy555809 commented Apr 13, 2024

A minesweeper quine:please use m to mark one grid, or use o to open it.

For example, mA0 marks A0, and oA0 opens it.

m[10],r[10],i,j,e,f,g,h,a[]={1,0,-1,0},b[]={0,1,0,-1},c[]={1
,0,-1,1,-1,1,0,-1},d[]={-1,-1,-1,0,0,1,1,1};l(x,y){int k;r[x
]|=1<<y;for(k=0;k<8;k++)if(x+c[k]>=0&&y+d[k]>=0&&m[x+c[k]]&(
1<<(y+d[k])))return;for(k=0;k<8;k++){e=x+c[k],f=y+d[k];if(e\
>=0&&f>=0&&e<10&&f<10&&(r[e]&(1<<f))==0)l(e,f);}}p(x){putch\
ar(x);}main(){char q,*s="m[]={%d,%d,%d,%d,%d,%d,%d,%d,%d,%d"
"},r[]={%d,%d,%d,%d,%d,%d,%d,%d,%d,%d},i,j,e,f,g,h,a[]={1,0"
",-1,0},b[]={0,1,0,-1},c[]={1,0,-1,1,-1,1,0,-1},d[]={-1,-1,"
"-1,0,0,1,1,1};l(x,y){int k;r[x]|=1<<y;for(k=0;k<8;k++)if(x"
"+c[k]>=0&&m[x+c[k]]&(1<<(y+d[k])))return;for(k=0;k<8;k++){"
"e=x+c[k],f=y+d[k];if(e>=0&&f>=0&&e<10&&f<10&&(r[e]&(1<<f))"
"==0)l(e,f);}}p(x){putchar(x);}main(){char q,t,*s=%c%s%c;t="
"getchar();scanf(%c%%c%%d%c,&q,&h);q-=65;if(m[h]&(1<<q))if("
"t==111)printf(%cGAME OVER%%c%c,10);else r[h]|=(1<<q);else "
"l(h,q);printf(s,m[0],m[1],m[2],m[3],m[4],m[5],m[6],m[7],m["
"8],m[9],r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],r[9],"
"34,s,34,34,34,34,34);p(10);p(47);p(47);p(32);p(32);for(i=0"
";i<10;i++)p(65+i);p(10);for(i=0;i<10;i++){p(47);p(47);p(48"
"+i);p(32);for(j=0;j<10;j++)if((r[i]&(1<<j))==0)p(46);else "
"if(m[i]&(1<<j))p(80);else{e=0;for(h=0;h<8;h++)if(i+c[h]>=0"
"&&(m[i+c[h]]&(1<<(j+d[h]))))e++;p(e?(48+e):32);}p(10);}}";;
srand(time(0));for(i=0;i<10;i++)for(j=0;j<=9;j++){if(rand()%
10==0)m[i]|=(1<<j);}while(m[(h=rand())%10]&(1<<(h/10%10)));l
(h%10,h/10%10);printf(s,m[0],m[1],m[2],m[3],m[4],m[5],m[6],m
[7],m[8],m[9],r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],r
[9],34,s,34,34,34,34,34);p(10);p(47);p(47);p(32);p(32);for(i
=0;i<10;i++)p(65+i);p(10);for(i=0;i<10;i++){p(47);p(47);p(48
+i);p(32);for(j=0;j<10;j++)if((r[i]&(1<<j))==0)p(46);else if
(m[i]&(1<<j))p(80);else{e=0;for(h=0;h<8;h++)if(i+c[h]>=0&&j+
d[h]>=0&&(m[i+c[h]]&(1<<(j+d[h]))))e++;p(e?(48+e):32);}p(10)
;}}/////////////////////////////////////////////////////////

@houmy555809
Copy link

And the "megaquine": It outputs its own code in ASCII art! Run it in C, and in fullscreen console.

a[58]={32570943,17333823,32287,1113663,33095199,7502980,330\
94719,17333809,4198532,2099276,8661386,270604,28341,31281,1\
4894,32045584,16301089,31280,15218734,4339846,17967,17732,2\
2186,10378,166024,32575775,2295879,6588559,31520830,6650946,
33060926,15235630,32575620,15252014,15252526,15324974,448512
,4329476,27070835,4521984,13186637,4657152,4464900,4261956,\
31744,4357252,1016800,12853516,6359110,6578438,12651596,131\
208,10813440,4325376,2236546,136,8521864},b[256],i,j,k,l;ch\
ar m[]="abcdefghijklmnopqrstuvwxyz1234567890~!%^&*()-+=[]{}"
"; '<,> ";w(char s[]){for(l=0;l<68;l++){for(i=4;i>=0;i--){f\
or(j=l*25;j<strlen(s)&&j<l*25+25;j++){for(k=4;k>=0;k--)putc\
har(3*((((b[s[j]]>>(i*5))&31)>>k)&1)+32);putchar(32);}putch\
ar(10);}putchar(10);}}main(){m[52]=34;for(i=0;i<57;i++)b[m[i
]]=a[i];char s[]="a[58]={32570943,17333823,32287,1113663,33"
"095199,7502980,33094719,17333809,4198532,2099276,8661386,2"
"70604,28341,31281,14894,32045584,16301089,31280,15218734,4"
"339846,17967,17732,22186,10378,166024,32575775,2295879,658"
"8559,31520830,6650946,33060926,15235630,32575620,15252014,"
"15252526,15324974,448512,4329476,27070835,4521984,13186637"
",4657152,4464900,4261956,31744,4357252,1016800,12853516,63"
"59110,6578438,12651596,131208,10813440,4325376,2236546,136"
",8521864},b[256],i,j,k,l;char m[]=%cabcdefghijklmnopqrstuv"
"wxyz1234567890~!%^&*()-+=[]{}; '<,> %c;w(char s[]){for(l=0"
";l<68;l++){for(i=4;i>=0;i--){for(j=l*25;j<strlen(s)&&j<l*2"
"5+25;j++){for(k=4;k>=0;k--)putchar(3*((((b[s[j]]>>(i*5))&3"
"1)>>k)&1)+32);putchar(32);}putchar(10);}putchar(10);}}main"
"(){m[52]=34;for(i=0;i<57;i++)b[m[i]]=a[i];char s[]=%c%s%c;"
"char t[1024];sprintf(t,s,34,34,34,s,34);w(t);}";char t[1024
];sprintf(t,s,34,34,34,s,34);w(t);}/////////////////////////

@houmy555809
Copy link

houmy555809 commented Apr 20, 2024

I just golfed the "megaquine" project slightly. The new code is:

a[58]={32570943,17333823,32287,1113663,33095199,7502980
,33094719,17333809,4198532,2099276,8661386,270604,28341
,31281,14894,32045584,16301089,31280,15218734,4339846,\
17967,17732,22186,10378,166024,32575775,2295879,6588559
,31520830,6650946,33060926,15235630,32575620,15252014,\
15252526,15324974,448512,4329476,27070835,4521984,1318\
6637,4657152,4464900,4261956,31744,4357252,1016800,128\
53516,6359110,6578438,12651596,131208,10813440,4325376,
2236546,136,8521864},b[256],i,j,k,l,n=34;char m[]="abc"
"defghijklmnopqrstuvwxyz1234567890~!%^&*()-+=[]{}; '<,"
"> ";p(c){putchar(c);}w(char s[]){for(l=0;l<1375;l+=25)
{for(i=5;--i>=0;){for(j=l;j<strlen(s)&&j<l+25;j++){for(
k=5;--k>=0;)p(3*((b[s[j]]>>i*5&31)>>k&1)+32);p(32);}p(\
10);}p(10);}}main(){m[52]=n;for(i=0;i<57;i++)b[m[i]]=a[
i];char s[]="a[58]={%s},b[256],i,j,k,l,n=34;char m[]=%"
"cabcdefghijklmnopqrstuvwxyz1234567890~!%^&*()-+=[]{};"
" '<,> %c;p(c){putchar(c);};w(char s[]){for(l=0;l<1375"
";l+=25){for(i=5;--i>=0){for(j=l;j<strlen(s)&&j<l+25;j"
"++){for(k=5;--k>=0)p(3*((b[s[j]]>>i*5&31)>>k&1)+32);p"
"(32);}p(10);}p(10);}}main(){m[52]=n;for(i=0;i<57;i++)"
"b[m[i]]=a[i];char s[]=%c%s%c;char c[512],t[1024];spri"
"ntf(c,%c%%d%c,a[0]);for(i=1;i<57;i++)sprintf(c,%c%%s,"
"%%d%c,c,a[i]);sprintf(t,s,n,n,n,s,n,n,n,n,n);w(t);}";\
char c[512],t[1024];sprintf(c,"%d",a[0]);for(i=1;i<57;i
++)sprintf(c,"%s,%d",c,a[i]);sprintf(t,s,c,n,n,n,s,n,n,
n,n,n);w(t);}/////////Megaquine by houmy555809/////////

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants