nanochess wrote:You forgotted to put your name and date of modification in the patch line, people could think that I wrote it
, please correct it.
By the way, I'm wondering why appears
in my program.
Oops!
That is something I used when I was trying to debug it, (finding the reason for the memory increase, checking if it was due to stack growth). I guess I forgot to remove it.
The posted games were in PGN, not?
This is the corrected version:
Code: Select all
/**************************************************************************\
| Toledo Nanochess (c) Copyright 2009 Oscar Toledo G. All rights reserved |
| 1274 non-blank characters. Evolution from my winning IOCCC 2005 entry. |
| o Use D2D4 algebraic style for movements. biyubi@gmail.com Feb/13/2009 |
| o On promotion add a number for final piece (3=N, 4=B, 5=R, 6=Q) |
| o Press Enter alone for computer to play. |
| o Full legal chess moves. |
| o Remove these comments to get 1341 bytes source code (*NIX end-of-line) |
| o This version patched by H.G.Muller 23/2/2009 to not crash under Cygwin |
\**************************************************************************/
char*l="ustvrtsuqqqqqqqqyyyyyyyy}{|~z|{}"
" + BAW~abcddcba .pknbrq PKNBRQ\n?A6J57IKJT576,+-48HLSU";
#define F getchar()%16
#define v D(21,0,0,0,
#define Z while(
#define _ ;if(
#define P return y^=8,
B,i,y,u,b,I[120],G,x=10,z=15,q=100;D(f,w,c,h,e,S,s){int t,o,L,E,d,O=f,N=-1e9,p,
*g,n,*m=I,H,A,q,r,C,a=y?-x:x;y^=8;d=!s||1e5>v 0,1,0);H=G;do{_ o=I[p=O]){q
=o&z^y _ q<7){A=q--&2?8:4;C=o-9&z?q["& .$ "]:42;do{r=I[p+=C[l]-64]_!w|p==w&&q|
A>2|!r){g=q|p+a-e?0:I+e _!r&(q|A<3||g)|(r+1&z^y)>9){m=0 _!(r-2&7))P G=O,1e6-1e3
*h;n=o&z;t=q|p>28&p<91?n+1:(n+=2,7^y);Z n-t){p[I]=n,E=O[I]=m?*g=*m,*m=0:g?*g=0:
0;L=(1-q?l[p/x+5]-l[O/x+5]+l[p%x+6]-l[O%x+6]+o/16*8:!!m*9)+(!q?l[p%x+6]-98+!(I[
p-1]^n)+!(I[p+1]^n)+l[n&7]*9-387+!!g*99+(1==A&&(E=p)):0)+(r?l[r&7]*9-288-h-q:0)
+!(I[p-a]&z^y^9);L-=s>h||s==h&(L>z&1<s|!d)?D(H,s>h|!d?0:p,L,h+1,E,N,s):0 _!(
B-O|i-n|h|p-b|S|L<-1e5))return u=E;O[I]=o;p[I]=r;m?*m=*g,*g=0:g?*g=9^y:0 _ L>N)
{N=L;G=O _!h&S&&s)i=n,B=O,b=p _ h&&c-L<S)P L;}q==1&A>6&!m&&(g=I+p,m=p<O?g-3:g+2
,o-y+*m>32&!r&!I[p+=p-O]&!m[p<O?1:-1]&!!s&d&L>-1e5)?0:n++;}}}}Z!r&q>2||(p=O,q|A
>2|(o&16&&!r)&&++C&&--A));}}}Z++O>98?O=20:f-O);P N+1e9?N<-998100+1e3*h&d?0:N:0;
}main(){Z B<120)I[B++]=B%x?B/x%x<2|B%x<2?z:B/x&4?0:*l++&31:7;Z i=19){Z++i<q)write(1,l+(
i[I]|16),1)_ x-(B=F)){i=I[B+=q-F*x]&z;b=F;b+=q-F*x;Z x-(G=F))i=G^8^y;}else G=v u,
1,5);v u,0,1);}}
Please, Jim, could you also replace the source in your Toledo_nanochess zip download by this version? There is no need to recompile, the removal of an unused global variable should have no effect on the executable.