Toledo: Chess & CP/M
Rayman
Posts: 14,665
I played around with this stuff with Catalina, but don't remember if I ever got it to work...
http://www.nanochess.org/index.html
Nanochess doesn't compile, but Toledo Chess 1 does (scroll down and the code looks like something:) ):
It even works! It's too big for LMM, but works with CMM.
The CP/M code seems to compile if I comment out the "system" calls.
I'll have to try that tonight...
http://www.nanochess.org/index.html
Nanochess doesn't compile, but Toledo Chess 1 does (scroll down and the code looks like something:) ):
[SIZE=2]#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; } [/SIZE]
It even works! It's too big for LMM, but works with CMM.
The CP/M code seems to compile if I comment out the "system" calls.
I'll have to try that tonight...
Comments
Did find somebody who got it working on a microcontroller though:
http://microcontrollers.2385.n7.nabble.com/Intel-8080-system-emulation-Running-CP-M-on-your-Ethernut-Board-td160903.html
Not sure about CP/M, but usually a system("text"); call means to run some O/S command.
First downloaded ver.5, but that didn't look very easy to compile, so I found ver.3 and tried it...
I can actually get it to compile, but it doesn't run right...
This one is only a few thousand lines of code though, so maybe one day, I could get it running...
The Nanochess source code on this web page appears to contain a syntax error. Fix it, and Nanochess compiles and runs under Catalina.
Below is the corrected code (correction shown in red):
Here is the command I used to compile and load it (this is for a C3):
But given how long the program takes to make a move, I suspect "Deep Blue" doesn't have much to worry about!
Ross.
I give it "E2E4" and it moves right. But, when I hit "enter" so it moves itself, it just sits there...
Maybe it's just very, very slow like you said...
The program is useable and fairly easy to beat at level 2. At level 3, it can take a few minutes per move, but it plays a better game. I'll look into converting the Forth code into C, which should speed it up quite a bit.
So, I guess it takes somewhere between 0.5 and 3 hours to make a move.
Moved again... Maybe it's more like 30 minutes...