Changes

Jump to: navigation, search

Copy-Make

4,332 bytes added, 17:39, 10 May 2018
Created page with "'''Home * Chess * Position * Copy-Make''' While traversing a Search Tree, the '''Copy-Make''' approach keeps and updates local copies..."
'''[[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.

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

=Stack=
The alternative, to maintain those irreversible aspects inside a global structure, would require a [[Stack|stack]] ([https://en.wikipedia.org/wiki/LIFO_%28computing%29 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.
<pre>
// make
push (position.irreversibleAspects);
ply++;
update (position, move)
...
// unmake
ply--;
pop (position.irreversibleAspects);
// position is restored from stack
</pre>

=See also=
* [[Encoding Moves]]
* [[Incremental Updates]]
* [[Make Move]]
* [[Unmake Move]]

=Forum Posts=
==1995 ...==
* [https://groups.google.com/group/rec.games.chess.computer/browse_frm/thread/d842e67212ab1034 cheaper search ?] by [[James Swafford|James F. Long]], [[Computer Chess Forums|rgcc]], April 27, 1997 » [[Tristram]]
: [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
==2000 ...==
* [https://www.stmintz.com/ccc/index.php?id=312031 The need to unmake move] by [[Mathieu Pagé]], [[CCC]], August 19, 2003 » [[Unmake Move]]
* [http://www.talkchess.com/forum/viewtopic.php?t=29770 undo move vs. Position Cloning] by BoldReceiver, [[CCC]], September 16, 2009
: [http://www.talkchess.com/forum/viewtopic.php?t=29770&start=1 Re: undo move vs. Position Cloning] by [[Marco Costalba]], [[CCC]], September 16, 2009 » [[Stockfish]]
: [http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&p=291570&t=29770 Re: undo move vs. Position Cloning] by [[Don Dailey]], [[CCC]], September 16, 2009 » [[Doch]]
* [http://www.talkchess.com/forum/viewtopic.php?t=29798 copy/make vs make/unmake test results] by [[Robert Hyatt]], [[CCC]], September 19, 2009 » [[Crafty]]
==2010 ...==
* [http://www.open-chess.org/viewtopic.php?f=5&t=665 Copy Board vs Unmake Move] by ChrisJ, [[Computer Chess Forums|OpenChess Forum]], September 29, 2010
* [http://www.talkchess.com/forum/viewtopic.php?t=39938 performance of copy-make] by [[Rein Halbersma]], [[CCC]], August 02, 2011
* [http://www.talkchess.com/forum/viewtopic.php?t=47882 How costly is taking moves back ?] by [[Piotr Lopusiewicz]], [[CCC]], April 30, 2013
* [http://www.open-chess.org/viewtopic.php?f=5&t=2554 Saving info before making a move] by [[Christian Daley|CDaley11]], [[Computer Chess Forums|OpenChess Forum]], December 30, 2013
* [http://www.talkchess.com/forum/viewtopic.php?t=50805 copy/make vs make/unmake] by [[Robert Hyatt]], [[CCC]], January 07, 2014
* [http://www.talkchess.com/forum/viewtopic.php?t=53502 Memory usage in make/unmake vs logic complexity] by [[Matthew Lai]], [[CCC]], August 30, 2014
==2015 ...==
* [http://www.talkchess.com/forum/viewtopic.php?t=58647 Unifying make/undo and copy-make] by [[Rein Halbersma]], [[CCC]], December 21, 2015
* [http://www.talkchess.com/forum/viewtopic.php?t=62090 Copy-make vs Make/Unmake ?] by [[Mahmoud Uthman]], [[CCC]], November 12, 2016

'''[[Chess Position|Up one Level]]'''

Navigation menu