Difference between revisions of "Copy-Make"

From Chessprogramming wiki
Jump to: navigation, search
(Created page with "'''Home * Chess * Position * Copy-Make''' While traversing a Search Tree, the '''Copy-Make''' approach keeps and updates local copies...")
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
'''[[Main Page|Home]] * [[Chess]] * [[Chess Position|Position]] * Copy-Make'''
 
'''[[Main Page|Home]] * [[Chess]] * [[Chess Position|Position]] * Copy-Make'''
  
While traversing a [[Search Tree]], the '''Copy-Make''' approach keeps and updates local copies of certain aspects of a [[Chess Position|chess position]] inside an array indexed by [[Ply|ply]], which could also be interpreted as explicit, random accessible search [[Stack|stack]]. It usually refers the irreversible aspects of the position, like [[En passant|ep state]], [[Castling rights|castling rights]] and the [[Halfmove Clock|halfmove clock]], which can not [[Incremental Updates|incrementally updated]] during [[Unmake Move|unmake move]]. Some programs even keep reversible stuff inside an array, to avoid incremental update during unmake. Copy-Make is required, if aspects need to be accessed randomly in the current branch from the [[Root|root]] (or even starting game position) to the current one.  
+
While traversing a [[Search Tree]], the '''Copy-Make''' approach keeps and updates local copies of certain aspects of a [[Chess Position|chess position]] inside an array indexed by [[Ply|ply]], which could also be interpreted as explicit, random accessible search [[Stack|stack]]. It usually refers the irreversible aspects of the position, like [[En passant|ep state]], [[Castling Rights|castling rights]] and the [[Halfmove Clock|halfmove clock]], which can not [[Incremental Updates|incrementally updated]] during [[Unmake Move|unmake move]]. Some programs even keep reversible stuff inside an array, to avoid incremental update during unmake. Copy-Make is required, if aspects need to be accessed randomly in the current branch from the [[Root|root]] (or even starting game position) to the current one.  
  
 
=Copy-Make=
 
=Copy-Make=
Line 42: Line 42:
 
: [https://groups.google.com/group/rec.games.chess.computer/msg/730c03a83bf92807 Re: cheaper search ?] by [[Shaun Press]], [[Computer Chess Forums|rgcc]], April 28, 1997 » [[Vanilla Chess]], [[KnightCap]]
 
: [https://groups.google.com/group/rec.games.chess.computer/msg/730c03a83bf92807 Re: cheaper search ?] by [[Shaun Press]], [[Computer Chess Forums|rgcc]], April 28, 1997 » [[Vanilla Chess]], [[KnightCap]]
 
* [https://www.stmintz.com/ccc/index.php?id=40653 Unmake move v copy the board] by Hugh Cumper, [[CCC]], January 24, 1999
 
* [https://www.stmintz.com/ccc/index.php?id=40653 Unmake move v copy the board] by Hugh Cumper, [[CCC]], January 24, 1999
 +
* [https://www.stmintz.com/ccc/index.php?id=60557 Move Make/Unmake Questions] by [[Daniel Homan]], [[CCC]], July 15, 1999 » [[Unmake Move]]
 
==2000 ...==
 
==2000 ...==
 
* [https://www.stmintz.com/ccc/index.php?id=312031 The need to unmake move] by [[Mathieu Pagé]], [[CCC]], August 19, 2003 » [[Unmake Move]]
 
* [https://www.stmintz.com/ccc/index.php?id=312031 The need to unmake move] by [[Mathieu Pagé]], [[CCC]], August 19, 2003 » [[Unmake Move]]

Latest revision as of 11:32, 21 June 2020

Home * Chess * Position * Copy-Make

While traversing a Search Tree, the Copy-Make approach keeps and updates local copies of certain aspects of a chess position inside an array indexed by ply, which could also be interpreted as explicit, random accessible search stack. It usually refers the irreversible aspects of the position, like ep state, castling rights and the halfmove clock, which can not incrementally updated during unmake move. Some programs even keep reversible stuff inside an array, to avoid incremental update during unmake. Copy-Make is required, if aspects need to be accessed randomly in the current branch from the root (or even starting game position) to the current one.

Copy-Make

// make
memcpy (&position[ply+1].irrvrsAspects, 
        &position[ply  ].irrvrsAspects, 
        sizeof(irrvrsAspects));
ply++;
update (position[ply], move)
...
// unmake
ply--;
// position[ply] is still valid

Stack

The alternative, to maintain those irreversible aspects inside a global structure, would require a stack (LIFO), with push and global update during make, and pop from stack to global structure during unmake, and therefor higher memory bandwidth for copying back and forth.

// make
push (position.irreversibleAspects);
ply++;
update (position, move)
...
// unmake
ply--;
pop (position.irreversibleAspects);
// position is restored from stack

See also

Forum Posts

1995 ...

Re: cheaper search ? by Shaun Press, rgcc, April 28, 1997 » Vanilla Chess, KnightCap

2000 ...

Re: undo move vs. Position Cloning by Marco Costalba, CCC, September 16, 2009 » Stockfish
Re: undo move vs. Position Cloning by Don Dailey, CCC, September 16, 2009 » Doch

2010 ...

2015 ...

Up one Level