Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: EPD and the real world

Author: Yuriy Lyapko

Date: 02:09:08 10/10/05

Go up one level in this thread


1.pas has only one function and was used for debug purposes.

Here it is:
================================================================
function printmove2(m:tmove):string;
var s:string;i,j:integer;dubl:array [1..3] of integer;
begin
	if (m.bits and BCASTLE)<>0 then
		if
		((side=WHITE) and (m.sqfrom=E1) and (m.sqto=G1)) or
		((side=BLACK) and (m.sqfrom=E8) and (m.sqto=G8))
		then s:='O-O' else
		if
		((side=WHITE) and (m.sqfrom=E1) and (m.sqto=C1)) or
		((side=BLACK) and (m.sqfrom=E8) and (m.sqto=C8))
		then s:='O-O-O'
		else
	else begin
		case Abs(piece[m.sqfrom]) of
			KNIGHT:s:='N';
			BISHOP:s:='B';
			ROOK:s:='R';
			QUEEN:s:='Q';
			KING:s:='K';
			else s:='';
		end;
		j:=0;
		for i:=0 to moves_count-1 do begin
			if (lmoves[i].sqto=m.sqto) and
			(lmoves[i].sqfrom<>m.sqfrom) and
			(Abs(piece[lmoves[i].sqfrom])=Abs(piece[m.sqfrom])) and
			(lmoves[i].bits=m.bits) and
			(lmoves[i].promote=m.promote)
			then begin
				Inc(j);dubl[j]:=i;
			end;
		end;
		if j<>0 then begin
			if j>1 then
			s:=s+Chr((m.sqfrom and 7)+Ord('a'))+Chr($38-(m.sqfrom shr 3))
			else if (lmoves[dubl[1]].sqfrom and 7)<>(m.sqfrom and 7) then
			s:=s+Chr((m.sqfrom and 7)+Ord('a')) else
			s:=s+Chr($38-(m.sqfrom shr 3));
		end;
		if (m.bits and (BCAPTURE+BENPASSANT))<>0 then begin
			if ((m.bits and BPAWN)<>0) and (length(s)=0) then
			s:=s+Chr((m.sqfrom and 7)+Ord('a'));
			s:=s+'x';
		end;
		s:=s+Chr((m.sqto and 7)+Ord('a'))+Chr($38-(m.sqto shr 3));
		if (m.bits and BPROMOTE)<>0 then
		s:=s+'='+piece_char[m.promote];
	end;
	printmove2:=s;
end;
===================================================================
Best regards,
George



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.