Author: Daniel Shawul
Date: 01:20:18 05/05/04
Go up one level in this thread
void BOARD::makemove(MOVE* move)
{
RemoveInfluence(Player,pic,from);
//capture
if(move->is_capture())
{
if(move->is_enpassant())
{
RemoveInfluence(opp,pawn,ep_sq);
AddInfluence(Player,pic,to);
}
else
{
RemoveInfluence(opp,move->get_capture(),to);
}
}
//castling
if(move->is_castling())
{
AddInfluence(Player,king,to);
RemoveInfluence(Player,rook,fromc);
AddInfluence(Player,rook,toc);
}
//promotion
else if(move->is_promotion())
{
AddInfluence(Player,move->get_promote(),to);
}
else
{
if(!move->is_enpassant())
AddInfluence(Player,pic,to);
}
}
void BOARD::takeback(MOVE* move)
{
//promotion
if(move->is_promotion())
{
RemoveInfluence(Player,move->get_promote(),from);
}
//castling
else if(move->is_castling())
{
RemoveInfluence(Player,king,from);
RemoveInfluence(Player,rook,fromc);
AddInfluence(Player,rook,toc);
}
else
RemoveInfluence(Player,pic,from);
AddInfluence(Player,pic,to);
//captures
if(move->is_capture())
{
if(move->is_enpassant())
{
sq=from + ((from>to) ? DD : UU);
AddInfluence(opp,move->get_capture(),sq);
}
else
{
sq=from;
AddInfluence(opp,move->get_capture(),from);
}
}
}
AddInfluence(int col ,int pic, int sq)
{
1. remove attack of piece at sq
2. shorten slider attackts through sq
}
RemoveInfluence(int col ,int pic, int sq)
{
1. Add attack of piece at sq
2. extend slider attacks through sq
}
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.