GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Chess Programming Wiki
  • All pages
  • Other namespaces
  • Categories
  • Credits

This view

  • Original page
  • New address

GeezerVison is showing chessprogramming.org — Copy-Make - Chess Programming Wiki

Copy-Make

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.

Contents
  1. Copy-Make
  2. Stack
  3. See also
  4. Forum Posts
    1. 1995 ...
    2. 2000 ...
    3. 2010 ...
    4. 2015 ...

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

  • Encoding Moves
  • Incremental Updates
  • Make Move
  • Unmake Move

Forum Posts

1995 ...

  • cheaper search ? by James F. Long, rgcc, April 27, 1997 » Tristram

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

  • Unmake move v copy the board by Hugh Cumper, CCC, January 24, 1999
  • Move Make/Unmake Questions by Daniel Homan, CCC, July 15, 1999 » Unmake Move

2000 ...

  • The need to unmake move by Mathieu Pagé, CCC, August 19, 2003 » Unmake Move
  • undo move vs. Position Cloning by BoldReceiver, CCC, September 16, 2009

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

  • copy/make vs make/unmake test results by Robert Hyatt, CCC, September 19, 2009 » Crafty

2010 ...

  • Copy Board vs Unmake Move by ChrisJ, OpenChess Forum, September 29, 2010
  • performance of copy-make by Rein Halbersma, CCC, August 02, 2011
  • How costly is taking moves back ? by Piotr Lopusiewicz, CCC, April 30, 2013
  • Saving info before making a move by CDaley11, OpenChess Forum, December 30, 2013
  • copy/make vs make/unmake by Robert Hyatt, CCC, January 07, 2014
  • Memory usage in make/unmake vs logic complexity by Matthew Lai, CCC, August 30, 2014

2015 ...

  • Unifying make/undo and copy-make by Rein Halbersma, CCC, December 21, 2015
  • Copy-make vs Make/Unmake ? by Mahmoud Uthman, CCC, November 12, 2016

Up one Level

What links here

Contributors: GerdIsenberg.

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.