billr@tekred.TEK.COM (Bill Randle) (05/23/87)
Here is a diff to fix the premature checkmate problem in the BSD patched version of chess that was posted to comp.sources.games. Only the first sizeof(short *) bytes were being cleared instead of all 64*sizeof(short) bytes as is required. I'm sure there are some other lingering problems, but this should get you started. (The other two patches are just some minor cleanups.) -Bill Randle Moderator, comp.sources.games Tektronix, Inc. games-request@tekred.TEK.COM ------------------------------------ *** chess.c.orig Fri May 22 15:08:48 1987 --- chess.c Fri May 22 15:07:59 1987 *************** *** 4,10 **** Written by John Stanback (hplabs!hpfcla!hpisla!hpltca!jhs) Patches for BSD Unix by Rich Salz (rs@mirror.TMC.COM) - 5/3/87 ! */ #include <stdio.h> --- 4,10 ---- Written by John Stanback (hplabs!hpfcla!hpisla!hpltca!jhs) Patches for BSD Unix by Rich Salz (rs@mirror.TMC.COM) - 5/3/87 ! and Bill Randle (billr@tekred.TEK.COM) - 5/22/87 */ #include <stdio.h> *************** *** 538,544 **** } minute = et/60; second = (et - 60*minute); if (player == computer) gotoXY(50,18); else gotoXY(50,23); ! printw("%d:%d",minute,second); ClrEoln(); if (et > 0) srate = NodeCnt/et; else srate = 0; if (post) { --- 538,544 ---- } minute = et/60; second = (et - 60*minute); if (player == computer) gotoXY(50,18); else gotoXY(50,23); ! printw("%d:%02d",minute,second); ClrEoln(); if (et > 0) srate = NodeCnt/et; else srate = 0; if (post) { *************** *** 687,692 **** --- 687,693 ---- response_time = buff[0] ? atoi(buff) : DEF_TIME; ClrScreen(); PrintBoard(white,0,0,1); InitializeStats(); + time0 = time(0); ElapsedTime(1); GetOpenings(); } *************** *** 853,859 **** short piece,i,m0,*aloc,*s; #ifdef BSD ! bzero((char *)a, sizeof a); #else a = (short *)memset(a,0,64*sizeof(short)); #endif /* BSD */ --- 854,860 ---- short piece,i,m0,*aloc,*s; #ifdef BSD ! bzero((char *)a, 64*sizeof(short)); #else a = (short *)memset(a,0,64*sizeof(short)); #endif /* BSD */ -- -Bill Randle Tektronix, Inc. billr@tekred.TEK.COM