Add preview of 1984-2019
The 2020 winners are hinted it, but the source code is not there,
nor are the hints. Someone could look into the HTML and
see what was commented out, but that is not a problem because
WHO won is known and the name of their AWARD is known already.
Moreover a number of the winners have talked about what their
entirs do, so the commented out spoiler text is not a bit problem.
One will find HTML commented out with:
<!-- XXX remove when 2020 is ready
2020 links here
XXX remove when 2020 is ready -->
The "XXX remove when 2020 is ready" string is found at the
start and end comment blocks. Again, soneone could read
what was commented out, but that is OK since most of that
information is known or can be known. The following files
have such HTML comment blocks in them.
./winners.html
./years-spoiler.html
./years.html
In addition, ./all/summary.txt was modified to not
include the 2020 entries for the momemt.
The 2020 winner code AND write-ups are NOT part of this set.
p.s. The all/all.tar.bz2 does not contain the 2020 source code (yet?).
This commit is contained in:
1 parent
28efc67f5d
commit
c0663537cb
1683 files changed
+220064
No files matched your search
@@ -0,0 +1,18 @@
|
||||
|
||||
build: toledo
|
||||
|
||||
clean:
|
||||
|
||||
clobber:
|
||||
-rm toledo toledo2
|
||||
|
||||
toledo: toledo.c
|
||||
${CC} ${CFLAGS} ${LDFLAGS} $< -o $@
|
||||
|
||||
alt: toledo2
|
||||
|
||||
toledo2: toledo2.c
|
||||
${CC} ${CFLAGS} ${LDFLAGS} $< -o $@
|
||||
|
||||
data:
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
# Best game
|
||||
|
||||
Oscar Toledo G.
|
||||
Familia Toledo
|
||||
Av. Santa Cruz del Monte 9-304
|
||||
Ciudad Satelite Edo de Mexico
|
||||
CP 53110
|
||||
Mexico
|
||||
uno@biyubi.com
|
||||
|
||||
## Judges' comments
|
||||
|
||||
Challenge yourself with your ability to look 5, 6 or more moves ahead.
|
||||
Challenge your knowledge of C operator precedence. The following the
|
||||
move analysis via recursion while it executes moves. All while playing
|
||||
by the rules of C and Chess within a single function!
|
||||
|
||||
## Improved version
|
||||
|
||||
Better mate searching
|
||||
|
||||
### To build
|
||||
|
||||
cc toledo.c -o toledo
|
||||
|
||||
### To run
|
||||
|
||||
For two human players
|
||||
|
||||
toledo
|
||||
|
||||
To play against the program
|
||||
|
||||
toledo a
|
||||
|
||||
## Author's comments
|
||||
|
||||
### What does this program
|
||||
|
||||
This is a chess program, it can work in two modes: two-players, and one player
|
||||
(always white) against the machine. To get the first mode, run the program
|
||||
without arguments:
|
||||
|
||||
prog
|
||||
|
||||
The other mode is accesible running the program with one argument (5-ply
|
||||
analysis):
|
||||
|
||||
prog a
|
||||
|
||||
Two arguments for 6-ply analysis:
|
||||
|
||||
prog a b
|
||||
|
||||
And each succesive argument will analyze one ply more. There is no ply limit,
|
||||
but beyond 7 ply is very slow, try it at your own risk and computing time.
|
||||
|
||||
### Entering movements
|
||||
|
||||
When is your turn, you can enter your move, by example, as "d2d4" (without the
|
||||
quotes) and press the Enter key, the computer will check move legality and
|
||||
will warn you of illegal moves. All legal chess moves are permitted.
|
||||
|
||||
One special case is when you are doing promotion, you must enter the move with
|
||||
an extra letter indicating the desired piece.
|
||||
|
||||
By example "f7f8n" (supossing you have a pawn on f7), will promote it to a
|
||||
knight, substitute 'n' for the desired piece (N/Q/R/B).
|
||||
|
||||
Note that the program requires the piece letter, it will not select
|
||||
automatically a queen, so don't be surprised if it doesn't accept your move.
|
||||
|
||||
### Game status
|
||||
|
||||
The computer will check for checkmate and stalemate, also after each machine
|
||||
move, it will show the score of the position, an higher number is better for
|
||||
the computer, i.e. worst for you.
|
||||
|
||||
### Quirks
|
||||
|
||||
None.
|
||||
|
||||
### Program operation
|
||||
|
||||
This is a good example of a chess program reduced to the essential. In order
|
||||
to get it into the contest limits, I used short but slow and unintelligible
|
||||
algorithms.
|
||||
|
||||
The interface accounts for only a fraction of the code, the core does
|
||||
multiples functions, it is called recursively to analyze and evaluate each
|
||||
ply, does alpha-beta cutting, move generation, machine playing, check
|
||||
detection, illegal move verification and does moves after they are verified.
|
||||
|
||||
Also sets an standard on ultra-mini-chess programs, the player and the
|
||||
computer can do all legal chess moves, other features are:
|
||||
|
||||
* Illegal move verification.
|
||||
* Checkmate detection.
|
||||
* Stalemate detection.
|
||||
* Computer is tough (check 7-ply), even in 5 ply can give a surprise to
|
||||
amateur players.
|
||||
|
||||
### Obsfucation tricks
|
||||
|
||||
* Only one C function, really modular.
|
||||
* Extensive use of the trinary and comma operators, save a hard drive today.
|
||||
* Extensive use of C operator precedence, all good C programmers remember
|
||||
it... I cannot.
|
||||
* Exchanged operands every place is possible, someday someone will
|
||||
understand it,
|
||||
* Mixed and multifunction expressions on statements, in good old-BASIC
|
||||
style.
|
||||
* Macros used to hide C syntax, check unballanced parenthesis and calls with
|
||||
empty arguments!
|
||||
* Only includes strictly necessary standard headers, the linker takes care,
|
||||
and compiles faster... but I'm still not seeing the difference.
|
||||
* Uses only one string, very easy to I18N ;)
|
||||
@@ -0,0 +1,64 @@
|
||||
#define F getchar())
|
||||
#define H(z)*n++=z;
|
||||
#include <setjmp.h>
|
||||
#define v main(0,0,0
|
||||
#define Z while(
|
||||
#define _ if(
|
||||
#define o(d) (u[l]=0,l[d]=6^e,q=1e4>v,0),l[d]=0,u[l]=e^6,q)
|
||||
#define I(H,n) { _ r=l[x=H],!r|(r^e)<-1){ _ j=u[l],-7==r|6==r\
|
||||
){ n; e=~e; return 1e5- f; } u[l]=0,t=j+1,i=j-1; _!i&89<x)i\
|
||||
=j,t=6; _-1==t&30>x)t=j,i=-7; Z++i<t){ b=S; d=0; S&=63; \
|
||||
a=((j^e)!=1?6!=(j^e)?O[32+x/10]-O[u/10+32]-q:(S|=6!=j?8\
|
||||
:1,2==u-x)*9+9*(x-u==2):(d=1==j?x-u:u-x)/8+!(!((x-u)%\
|
||||
10)|r)*99+(j==1?90<x:29>x)*(9*O[28+i]-288))+O[r+28\
|
||||
]*9-288+O[x%10+33]-f-O[33+u%10]; x[l]=i; S|=(21=\
|
||||
=u|21==x)*2+(u==28|28==x)*4+(91==u|x==91)*16+32\
|
||||
*(u==98|x==98)+(20==d)*64*x; a-=k>f?main(a,f+1\
|
||||
,M,k):0; _ i==c&u==h&!f&N&a>-1e4&x==y)longjm\
|
||||
p(z,1); S=b; _!N|f&&(a>M||!f&a==M&&1&rand()\
|
||||
)){ _!f){ _ k){ c=i; h=u; y=x; } } else _ \
|
||||
L-a<N){ n; e=~e; u[l]=j; x[l]=r; return\
|
||||
a; } M=a; } } x[l]=r; u[l]=j; n; } }
|
||||
typedef int G; char J [ 78 ], O [ ]
|
||||
= "HRQAMS#-smaqrh[UTZYTU[|TBA("
|
||||
"$#(ABT|ba`gg`ab8>GK[_`fFDZXEYR" "L\t####"
|
||||
"##B#A#@#G#F#E#D#K\t\3Zlv#tjm" "\3J#tjm\3Pwb"
|
||||
"ofnbwf\3Joofdbo\3)&`&`.&`&`" "#+&g*\t"; G y,
|
||||
c,h,e,S,*s,l[149]; jmp_buf z ; G main(G L,G f,
|
||||
G N,G k){ G u=99,p,q,r,j,i,x ,t, a, b,d,M=-1e9
|
||||
; char *n; if( *l){ e=~e; Z u >21){ q= l[--u]^e;
|
||||
_!-- q){ _!l[p=e?u-10:u+10]){ I(p,)_ e?u>80 & !l[p
|
||||
-=10]:u<39&!l[p+=10])I(p,)} _ l[p=e?u-11:9+u] )I(p,)
|
||||
else _ u-1==S>>6){ l[u-1]=0; I(p,l[u-1]=-2^e); } _ l[
|
||||
p=e?u-9:11+u])I(p,)else _ S>>6==1+u){ l[1+u]=0; I(p,l
|
||||
[1+u]=e^-2); } } _!--q){ n=O+41; Z++n<50+O)I(u+80-*n,
|
||||
)} _ 0<q&4>q){ n=q==2?53+O:O+49; Z++n<O+(q!=1)*4+54
|
||||
){ p=u; do I(p-=*n-80,)Z!p[l]); } } _ 4==q){ n=49+O
|
||||
; Z++n<O+58)I(u-*n+80,)_ e&!(S&24)|!e&!(S&3)&&k&&
|
||||
!l[u-2]&!l[u-1]&!l[u-3]&&o(u)&o(u-1)){ l[u-1]= 4
|
||||
^e; l[u-4]=0; I(u-2,l[u-1]=0; l[u-4]=e^4); } _
|
||||
e&!(S&40)|!e&!(S&5)&&k&&!l[u+1]&!l[2+u]&&o(u)&
|
||||
o(1+u)){ l[u+1]=e^4; l[3+u]=0; I(u+2,l[1+u
|
||||
]=0; l[u+3]=4^e); } } } e=~e; return M; }
|
||||
Z h<130){l[h]=-(21>h|98<h|2 >(h+1 )%
|
||||
10); O[h++]^=3; } n=O +14; s=20+l; Z
|
||||
++s<29+l){ 10[s]=1; 70[s]=~ ( * s = *
|
||||
n++ -+84); 60 [ s] =-2; } Z n=J){ puts
|
||||
(58+O); u=19; Z++u<100){ H(32)_!( u%10
|
||||
))H(32)H(O[7+l[u]])_(9+u)%10>7){ H(58
|
||||
-u/10)H(32)_ u&1)puts(n=J); } } puts
|
||||
(O+58); _-1e4 >v , 1)){ e=~e; puts
|
||||
(O+(v,0)> 1e4?e?90:82:96)); break
|
||||
; } _ 1<L&e) { d=v,2+L); printf
|
||||
(O+114,h%10+64,58-h/10,y%10+64
|
||||
,58 -y/10,d); } else{ putchar
|
||||
(62 ) ; h= (95 & F-44; c=l[h
|
||||
+=(56-F *10]; y=(95&F-44; y
|
||||
+=(56-F*10; Z 10!=(u=(95
|
||||
&F)){ c=5; Z--c>1&&u!=c
|
||||
[O]); c=e^c-7; } } _!
|
||||
setjmp(z)){ v+1,1);
|
||||
puts( 106+
|
||||
O); } } Z
|
||||
10!=
|
||||
F; }
|
||||
@@ -0,0 +1,64 @@
|
||||
#define F getchar())
|
||||
#define H(z)*n++=z;
|
||||
#include <setjmp.h>
|
||||
#define v main(0,0,0
|
||||
#define Z while(
|
||||
#define _ if(
|
||||
#define o(d)(S=63,l[d]=6^e,q=1e4>v,u[l]=0),l[d]=0,u[l]=e^6,S=b,q)
|
||||
#define I(H,n) { _ r=l[x=H],!r|(r^e)<-1){ _ j=u[l],-7==r|6==r\
|
||||
){ n; e=~e; return 1e5-443*f; } u[l]=0,t=j+1,i=j-1; _!i&89<\
|
||||
x)i=j,t=6; _-1==t&30>x)t=j,i=-7; Z++i<t){ d =0; S&= 63; \
|
||||
a=((j^e)!=1?6!=(j^e)?O[32+x/10]-O[u/10+32]-q:(S|=6!=j?8\
|
||||
:1,2==u-x)*9+9*(x-u==2):(d=1==j?x-u:u-x)/8+!(!((x-u)%\
|
||||
10)|r)*99+(j==1?90<x:29>x)*(9*O[28+i]-288))+O[r+28\
|
||||
]*9-288+O[x%10+33]-f-O[33+u%10]; x[l]=i; S|=(21=\
|
||||
=u|21==x)*2+(u==28|28==x)*4+(91==u|x==91)*16+32\
|
||||
*(u==98|x==98)+(20==d)*64*x; a-=k>f?main(a,f+1\
|
||||
,M,k):0; _ i==c&u==h&!f&N&a>-1e4&x==y)longjm\
|
||||
p(z,1); S=b; _!N|f&&(a>M||!f&a==M&&1&rand()\
|
||||
)){ _!f){ _ k){ c=i; h=u; y=x; } } else _ \
|
||||
L-a<N){ n; e=~e; u[l]=j; x[l]=r; return\
|
||||
a; } M=a; } } x[l]=r; u[l]=j; n; } }
|
||||
typedef int G; char J [ 78 ], O [ ]
|
||||
= "HRQAMS#-smaqrh[UTZYTU[|TBA("
|
||||
"$#(ABT|ba`gg`ab8>GK[_`fFDZXEYR" "L\t####"
|
||||
"##B#A#@#G#F#E#D#K\t\3Zlv#tjm" "\3J#tjm\3Pwb"
|
||||
"ofnbwf\3Joofdbo\3)&`&`.&`&`" "#+&g*\t"; G y,
|
||||
c,h,e,S,*s,l[149]; jmp_buf z ; G main(G L,G f,
|
||||
G N,G k){ G u=99,p,q,r,j,i,x ,t,a,b=S,d,M=-1e9
|
||||
; char *n; if( *l){ e=~e; Z u >21){ q= l[--u]^e;
|
||||
_!-- q){ _!l[p=e?u-10:u+10]){ I(p,)_ e?u>80 & !l[p
|
||||
-=10]:u<39&!l[p+=10])I(p,)} _ l[p=e?u-11:9+u] )I(p,)
|
||||
else _ u-1==S>>6){ l[u-1]=0; I(p,l[u-1]=-2^e); } _ l[
|
||||
p=e?u-9:11+u])I(p,)else _ S>>6==1+u){ l[1+u]=0; I(p,l
|
||||
[1+u]=e^-2); } } _!--q){ n=O+41; Z++n<50+O)I(u+80-*n,
|
||||
)} _ 0<q&4>q){ n=q==2?53+O:O+49; Z++n<O+(q!=1)*4+54
|
||||
){ p=u; do I(p-=*n-80,)Z!p[l]); } } _ 4==q){ n=49+O
|
||||
; Z++n<O+58)I(u-*n+80,)_ e&!(S&24)|!e&!(S&3) &&
|
||||
!l[u-2]&!l[u-1]&!l[u-3]&&o(u)&o(u-1)){ l[u-1]= 4
|
||||
^e; l[u-4]=0; I(u-2,l[u-1]=0; l[u-4]=e^4); } _
|
||||
e&!(S&40)|!e&!(S&5) &&!l[u+1]&!l[2+u]&&o(u)&
|
||||
o(1+u)){ l[u+1]=e^4; l[3+u]=0; I(u+2,l[1+u
|
||||
]=0; l[u+3]=4^e); } } } e=~e; return M; }
|
||||
Z h<130){l[h]=-(21>h|98<h|2 >(h+1 )%
|
||||
10); O[h++]^=3; } n=O +14; s=20+l; Z
|
||||
++s<29+l){ 10[s]=1; 70[s]=~ ( * s = *
|
||||
n++ -+84); 60 [ s] =-2; } Z n=J){ puts
|
||||
(58+O); u=19; Z++u<100){ H(32)_!( u%10
|
||||
))H(32)H(O[7+l[u]])_(9+u)%10>7){ H(58
|
||||
-u/10)H(32)_ u&1)puts(n=J); } } puts
|
||||
(O+58); _-1e4 >v , 1)){ e=~e; puts
|
||||
(O+(v,0)> 1e4?e?90:82:96)); break
|
||||
; } _ 1<L&e) { d=v,2+L); printf
|
||||
(O+114,h%10+64,58-h/10,y%10+64
|
||||
,58 -y/10,d); } else{ putchar
|
||||
(62 ) ; h= (95 & F-44; c=l[h
|
||||
+=(56-F *10]; y=(95&F-44; y
|
||||
+=(56-F*10; Z 10!=(u=(95
|
||||
&F)){ c=5; Z--c>1&&u!=c
|
||||
[O]); c=e^c-7; } } _!
|
||||
setjmp(z)){ v+1,1);
|
||||
puts( 106+
|
||||
O); } } Z
|
||||
10!=
|
||||
F; }
|
||||
@@ -0,0 +1,64 @@
|
||||
#define F getchar())
|
||||
#define H(z)*n++=z;
|
||||
#include <setjmp.h>
|
||||
#define v main(0,0,0
|
||||
#define Z while(
|
||||
#define _ if(
|
||||
#define o(d)(S=63,u[l]=0,l[d]=6^e,q=1e4>v,0),l[d]=0,u[l]=e^6,S=b,q)
|
||||
#define I(H,n) { _ r=l[x=H],!r|(r^e)<-1){ _ j=u[l],-7==r|6==r\
|
||||
){ n; e=~e; return 1e5-443*f; } u[l]=0,t=j+1,i=j-1; _!i&89<\
|
||||
x)i=j,t=6; _-1==t&30>x)t=j,i=-7; Z++i<t){ d =0; S&= 63; \
|
||||
a=((j^e)!=1?6!=(j^e)?O[32+x/10]-O[u/10+32]-q:(S|=6!=j?8\
|
||||
:1,2==u-x)*9+9*(x-u==2):(d=1==j?x-u:u-x)/8+!(!((x-u)%\
|
||||
10)|r)*99+(j==1?90<x:29>x)*(9*O[28+i]-288))+O[r+28\
|
||||
]*9-288+O[x%10+33]-f-O[33+u%10]; x[l]=i; S|=(21=\
|
||||
=u|21==x)*2+(u==28|28==x)*4+(91==u|x==91)*16+32\
|
||||
*(u==98|x==98)+(20==d)*64*x; a-=k>f?main(a,f+1\
|
||||
,M,k):0; _ i==c&u==h&!f&N&a>-1e4&x==y)longjm\
|
||||
p(z,1); S=b; _!N|f&&(a>M||!f&a==M&&1&rand()\
|
||||
)){ _!f){ _ k){ c=i; h=u; y=x; } } else _ \
|
||||
L-a<N){ n; e=~e; u[l]=j; x[l]=r; return\
|
||||
a; } M=a; } } x[l]=r; u[l]=j; n; } }
|
||||
typedef int G; char J [ 78 ], O [ ]
|
||||
= "HRQAMS#-smaqrh[UTZYTU[|TBA("
|
||||
"$#(ABT|ba`gg`ab8>GK[_`fFDZXEYR" "L\t####"
|
||||
"##B#A#@#G#F#E#D#K\t\3Zlv#tjm" "\3J#tjm\3Pwb"
|
||||
"ofnbwf\3Joofdbo\3)&`&`.&`&`" "#+&g*\t"; G y,
|
||||
c,h,e,S,*s,l[149]; jmp_buf z ; G main(G L,G f,
|
||||
G N,G k){ G u=99,p,q,r,j,i,x ,t,a,b=S,d,M=-1e9
|
||||
; char *n; if( *l){ e=~e; Z u >21){ q= l[--u]^e;
|
||||
_!-- q){ _!l[p=e?u-10:u+10]){ I(p,)_ e?u>80 & !l[p
|
||||
-=10]:u<39&!l[p+=10])I(p,)} _ l[p=e?u-11:9+u] )I(p,)
|
||||
else _ u-1==S>>6){ l[u-1]=0; I(p,l[u-1]=-2^e); } _ l[
|
||||
p=e?u-9:11+u])I(p,)else _ S>>6==1+u){ l[1+u]=0; I(p,l
|
||||
[1+u]=e^-2); } } _!--q){ n=O+41; Z++n<50+O)I(u+80-*n,
|
||||
)} _ 0<q&4>q){ n=q==2?53+O:O+49; Z++n<O+(q!=1)*4+54
|
||||
){ p=u; do I(p-=*n-80,)Z!p[l]); } } _ 4==q){ n=49+O
|
||||
; Z++n<O+58)I(u-*n+80,)_ e&!(S&24)|!e&!(S&3) &&
|
||||
!l[u-2]&!l[u-1]&!l[u-3]&&o(u)&&o(u-1)){ l[u-1]=4
|
||||
^e; l[u-4]=0; I(u-2,l[u-1]=0; l[u-4]=e^4); } _
|
||||
e&!(S&40)|!e&!(S&5) &&!l[u+1]&!l[2+u]&&o(u)&&
|
||||
o(1+u)){ l[u+1]=e^4; l[3+u]=0; I(u+2,l[1+u
|
||||
]=0; l[u+3]=4^e); } } } e=~e; return M; }
|
||||
Z h<130){l[h]=-(21>h|98<h|2 >(h+1 )%
|
||||
10); O[h++]^=3; } n=O +14; s=20+l; Z
|
||||
++s<29+l){ 10[s]=1; 70[s]=~ ( * s = *
|
||||
n++ -+84); 60 [ s] =-2; } Z n=J){ puts
|
||||
(58+O); u=19; Z++u<100){ H(32)_!( u%10
|
||||
))H(32)H(O[7+l[u]])_(9+u)%10>7){ H(58
|
||||
-u/10)H(32)_ u&1)puts(n=J); } } puts
|
||||
(O+58); _-1e4 >v , 1)){ e=~e; puts
|
||||
(O+(v,0)> 1e4?e?90:82:96)); break
|
||||
; } _ 1<L&e) { d=v,2+L); printf
|
||||
(O+114,h%10+64,58-h/10,y%10+64
|
||||
,58 -y/10,d); } else{ putchar
|
||||
(62+e); h= (95 & F-44; c=l[h
|
||||
+=(56-F *10]; y=(95&F-44; y
|
||||
+=(56-F*10; Z 10!=(u=(95
|
||||
&F)){ c=5; Z--c>1&&u!=c
|
||||
[O]); c=e^c-7; } } _!
|
||||
setjmp(z)){ v+1,1);
|
||||
puts( 106+
|
||||
O); } } Z
|
||||
10!=
|
||||
F; }
|
||||
Reference in new issue
Block a user