Author: Larry Griffiths
Date: 07:24:51 07/30/00
Hellow again :)
Im back to the efficiency thing again in my bruteforce code...
I know I could see if the king is in check after looking at the squares are
empty and that there is a rook on the proper square that has not moved.
Must I do the extra 4 tests to see if the king and rook destination squares are
not attacked by the opponents pieces or are there any tricky ways to bypass this
:)
//---------------------------------
defbbGenNonSlidingMoves(MySquare,bbMaskKingAttacks);
if(tcSquare[MySquare]->MoveCount==0)
{
defbbPiecesAttackingABlackKing(MySquare);
if(!bbAttackedByPieces[0])
{
// See if King can Castle Kingside.
if(tcSquare[MySquare+1]->Type==ptEMPTY)
{
if(tcSquare[MySquare+2]->Type==ptEMPTY)
{
if(tcSquare[MySquare+3]->MoveCount==0)
{
if(tcSquare[MySquare+3]->TypeColor==ptcBROOK)
{
defbbPiecesAttackingABlackKing(MySquare+1);
if(!bbAttackedByPieces[0])
{
defbbPiecesAttackingABlackKing(MySquare+2);
if(!bbAttackedByPieces[0])
{
MoveTo=MySquare+2;
TCAddMoveOnly;
}
}
}
}
}
}
// See if King can Castle Queenside.
if(tcSquare[MySquare-1]->Type==ptEMPTY)
{
if(tcSquare[MySquare-2]->Type==ptEMPTY)
{
if(tcSquare[MySquare-3]->Type==ptEMPTY)
{
if(tcSquare[MySquare-4]->MoveCount==0)
{
if(tcSquare[MySquare-4]->TypeColor==ptcBROOK)
{
defbbPiecesAttackingABlackKing(MySquare-1);
if(!bbAttackedByPieces[0])
{
defbbPiecesAttackingABlackKing(MySquare-2);
if(!bbAttackedByPieces[0])
{
MoveTo=MySquare-2;
TCAddMoveOnly;
}
}
}
}
}
}
}
}
}
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.