Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
12 deleted 61 characters in body
source | link

C, 640590 760640 760 880 963 1018

#define W 40
int Y,X,T,LP,px[W*W]Q[W*W],D[]={-W,-1,1,W};char B[W*W],K[W*W],Ks[W];I[W];
t(x,d,s){int d=0,s=T;forfor(L=0;B[x]&7;P=0;B[x];x*=x!=*Q){
s-=K[px[L++]=x]=K[Q[P++]=x]-1;d=1,
d=(54202126527627840ll>>2*(d*7+(B[x+=D[d]]&7))d*7+B[x+=D[d]]%8)&3;
if(x==*px)return&3;return x?0:s;}return 0;}
m(x){int o,c=K[x],u=B[x-W],Bu=u&7U=u&7,l=B[x-1],Bl=l&7L=l&7,r=0,
i=Bui=U!=3&&Bu=3&U!=4&&Bl=4&L!=2&&Bl=2&L!=4;=4,o=(39>>U)&1?57:70;o&=(52>>L)&1?42:85;
if(x/W>Y+1){for(;;P--L>=0;;)printf("%d %d ",px[L]%WQ[P]%W-1,px[L]Q[P]/W-1);exit(0);}
o=(39>>Bu)&1?57:70;o&=(52>>Bl)&1?42:85;
if(u>7)o&=Bu>4o&=U>4?~64:~6;
if~6;if(l>7)o&=Bl>4o&=L>4?~32:~10;
for(o&=c?c>1?c>2?(r=8*i,96):(r=8,i*30):~0:1;
for(;o;r++1;o;r++,o>>=1o/=2) 
if(o&1)if(B[x]=r,r%8!=1||!t(x,0,T))m(x+1);B[x]=0;}
main(){for(;gets(KsI);Y++)for(X=0;Ks[X];X++X=0;I[X];X++)
T+=(K[X+1+Y*W+W]=Ks[X]K[X+1+Y*W+W]=I[X]/36)-1;m(W+1W);}

C, 640 760 880 963 1018

#define W 40
int Y,X,T,L,px[W*W],D[]={-W,-1,1,W};char B[W*W],K[W*W],Ks[W];
t(x){int d=0,s=T;for(L=0;B[x]&7;){
s-=K[px[L++]=x]-1;d=(54202126527627840ll>>2*(d*7+(B[x+=D[d]]&7)))&3;
if(x==*px)return s;}return 0;}
m(x){int o,c=K[x],u=B[x-W],Bu=u&7,l=B[x-1],Bl=l&7,r=0,
i=Bu!=3&&Bu!=4&&Bl!=2&&Bl!=4;
if(x/W>Y+1){for(;--L>=0;)printf("%d %d ",px[L]%W-1,px[L]/W-1);exit(0);}
o=(39>>Bu)&1?57:70;o&=(52>>Bl)&1?42:85;
if(u>7)o&=Bu>4?~64:~6;
if(l>7)o&=Bl>4?~32:~10;
o&=c?c>1?c>2?(r=8*i,96):(r=8,i*30):~0:1;
for(;o;r++,o>>=1)if(o&1)if(B[x]=r,r%8!=1||!t(x))m(x+1);B[x]=0;}
main(){for(;gets(Ks);Y++)for(X=0;Ks[X];X++)
T+=(K[X+1+Y*W+W]=Ks[X]/36)-1;m(W+1);}

C, 590 640 760 880 963 1018

#define W 40
int Y,X,T,P,Q[W*W],D[]={-W,-1,1,W};char B[W*W],K[W*W],I[W];
t(x,d,s){for(P=0;B[x];x*=x!=*Q)s-=K[Q[P++]=x]-1,
d=(54202126527627840ll>>2*(d*7+B[x+=D[d]]%8))&3;return x?0:s;}
m(x){int c=K[x],u=B[x-W],U=u&7,l=B[x-1],L=l&7,r=0,
i=U!=3&U!=4&L!=2&L!=4,o=(39>>U)&1?57:70;o&=(52>>L)&1?42:85;
if(x/W>Y+1){for(;P--;)printf("%d %d ",Q[P]%W-1,Q[P]/W-1);exit(0);}
if(u>7)o&=U>4?~64:~6;if(l>7)o&=L>4?~32:~10;
for(o&=c?c>1?c>2?(r=8*i,96):(r=8,i*30):~0:1;o;r++,o/=2) 
if(o&1)if(B[x]=r,r%8!=1||!t(x,0,T))m(x+1);B[x]=0;}
main(){for(;gets(I);Y++)for(X=0;I[X];X++)
T+=(K[X+1+Y*W+W]=I[X]/36)-1;m(W);}
11 deleted 194 characters in body
source | link

C, 760640 880760 880 963 1018

I don't assume the board is square as the larger puzzles tend not to be square.

Reaching the limit of golfing, I think.

#define W 40
int Y,X,T,L;char B[W][W]L,K[W][W]px[W*W],Ks[W]D[]={-W,px[2*W*W];-1,1,W};char B[W*W],K[W*W],Ks[W];
t(int x,int y){int d=0,s=0;fors=T;for(L=0;B[x][y]&7;L=0;B[x]&7;){
px[L++]=x;px[L++]=y;s+=K[x][y];x+=(d==2)s-(d==1);y+=(d==3)=K[px[L++]=x]-(d==0);
d=1;d=(54202126527627840ll>>2*(d*7+(B[x][y]&7B[x+=D[d]]&7)))&3;
if(x==px[0]&&y==px[1]x==*px)return s;
 }return T;0;}
m(int x,int y) {
 int i,o,c=K[x][y]c=K[x],u=B[x][yu=B[x-1]W],Bu=u&7,l=B[x-1][y]1],Bl=l&7,r=0;r=0,
i=Bu!=3&&Bu!=4&&Bl!=2&&Bl!=4;
if(y>Yx/W>Y+1){for(i=0;i<L;i++;--L>=0;)printf("%d %d ",px[i]px[L]%W-1,px[L]/W-1);exit(0);}
o=(39>>Bu)&1?57:70;o&=(52>>Bl)&1?42:85;
if(x==X)o&=75;
if(y==Y)o&=39;
if(u>7)o&=Bu>4?~64:~6;
if(l>7)o&=Bl>4?~32:~10;
i=Bu!=3&&Bu!=4&&Bl!=2&&Bl!=4;
ifo&=c?c>1?c>2?(c==52)o&=i*30r=8*i,r=8;
if(c==7396)o&=96:(r=8,r=8*i;i*30):~0:1;
for(;o;r++,o>>=1)if(o&1)if(B[x][y]=rB[x]=r,r%8!=1||T==t=1||!t(x,y))x<X?m(x+1,y):m(1,y+1);
B[x][y]=0;;B[x]=0;}
main(){for(;gets(Ks);Y++)for(X=0;Ks[X];X++)
T+=K[X+1][Y+1]=Ks[X]T+=(K[X+1+Y*W+W]=Ks[X]/36)-46;m1;m(1,1W+1);}

Test meme.

C, 760 880 963 1018

I don't assume the board is square as the larger puzzles tend not to be square.

Reaching the limit of golfing, I think.

#define W 40
int Y,X,T,L;char B[W][W],K[W][W],Ks[W],px[2*W*W];
t(int x,int y){int d=0,s=0;for(L=0;B[x][y]&7;){
px[L++]=x;px[L++]=y;s+=K[x][y];x+=(d==2)-(d==1);y+=(d==3)-(d==0);
d=(54202126527627840ll>>2*(d*7+(B[x][y]&7)))&3;
if(x==px[0]&&y==px[1])return s;
 }return T;}
m(int x,int y) {
 int i,o,c=K[x][y],u=B[x][y-1],Bu=u&7,l=B[x-1][y],Bl=l&7,r=0;
if(y>Y){for(i=0;i<L;i++)printf("%d ",px[i]-1);exit(0);}
o=(39>>Bu)&1?57:70;o&=(52>>Bl)&1?42:85;
if(x==X)o&=75;
if(y==Y)o&=39;
if(u>7)o&=Bu>4?~64:~6;
if(l>7)o&=Bl>4?~32:~10;
i=Bu!=3&&Bu!=4&&Bl!=2&&Bl!=4;
if(c==52)o&=i*30,r=8;
if(c==73)o&=96,r=8*i;
for(;o;r++,o>>=1)if(o&1)if(B[x][y]=r,r%8!=1||T==t(x,y))x<X?m(x+1,y):m(1,y+1);
B[x][y]=0;}
main(){for(;gets(Ks);Y++)for(X=0;Ks[X];X++)
T+=K[X+1][Y+1]=Ks[X]-46;m(1,1);}

Test me.

C, 640 760 880 963 1018

I don't assume the board is square as the larger puzzles tend not to be square.

#define W 40
int Y,X,T,L,px[W*W],D[]={-W,-1,1,W};char B[W*W],K[W*W],Ks[W];
t(x){int d=0,s=T;for(L=0;B[x]&7;){
s-=K[px[L++]=x]-1;d=(54202126527627840ll>>2*(d*7+(B[x+=D[d]]&7)))&3;
if(x==*px)return s;}return 0;}
m(x){int o,c=K[x],u=B[x-W],Bu=u&7,l=B[x-1],Bl=l&7,r=0,
i=Bu!=3&&Bu!=4&&Bl!=2&&Bl!=4;
if(x/W>Y+1){for(;--L>=0;)printf("%d %d ",px[L]%W-1,px[L]/W-1);exit(0);}
o=(39>>Bu)&1?57:70;o&=(52>>Bl)&1?42:85;
if(u>7)o&=Bu>4?~64:~6;
if(l>7)o&=Bl>4?~32:~10;
o&=c?c>1?c>2?(r=8*i,96):(r=8,i*30):~0:1;
for(;o;r++,o>>=1)if(o&1)if(B[x]=r,r%8!=1||!t(x))m(x+1);B[x]=0;}
main(){for(;gets(Ks);Y++)for(X=0;Ks[X];X++)
T+=(K[X+1+Y*W+W]=Ks[X]/36)-1;m(W+1);}

Test me.

10 added 152 characters in body
source | link

The W define sets the limit on the board dimensions. The actual limit is smaller W - 2 as I use extra rows for borders to avoid boundary checks.

The W define sets the limit on the board dimensions. The actual limit is smaller W - 2 as I use extra rows for borders to avoid boundary checks.

9 deleted 17 characters in body
source | link
8 deleted 121 characters in body
source | link
7 added 91 characters in body
source | link
6 added 1152 characters in body
source | link
5 deleted 87 characters in body
source | link
4 deleted 12 characters in body
source | link
3 deleted 169 characters in body
source | link
2 added 161 characters in body
source | link
1
source | link