Author: Omid David Tabibi
Date: 01:35:54 05/05/04
Go up one level in this thread
On May 05, 2004 at 04:20:18, Daniel Shawul wrote:
>
>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
>}
Incremental update will be better only if it is done efficiently. You must use a
good profiler (e.g., Intel VTune) to find the bottlenecks and optimize your
implementation. Many times the profiler will indicate hotspots that cannot be
easily noticed without profiling.
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.