Difference between revisions of "Make Move"
GerdIsenberg (talk | contribs) (Created page with "'''Home * Chess * Moves * Make Move''' '''Make Move''' is a function inside a chess program to update the internal chess position and...") |
GerdIsenberg (talk | contribs) m |
||
Line 4: | Line 4: | ||
=Operations= | =Operations= | ||
− | The general arithmetical and/or bitwise-logical operations to convert a node to its child are either reversible (even for [[Irreversible Moves|irreversible moves]]), by [https://en.wikipedia.org/wiki/Inverse_function inverse] (e.g. addition and subtraction) or [https://en.wikipedia.org/wiki/Involution_%28mathematics%29 own inverse] ([[General Setwise Operations#ExclusiveOr|exclusive or]]) operations, or are irreversible, for instance a sequence of addition and conjunction (add, and) of move aspects, to update [[En passant|ep state]], [[Castling | + | The general arithmetical and/or bitwise-logical operations to convert a node to its child are either reversible (even for [[Irreversible Moves|irreversible moves]]), by [https://en.wikipedia.org/wiki/Inverse_function inverse] (e.g. addition and subtraction) or [https://en.wikipedia.org/wiki/Involution_%28mathematics%29 own inverse] ([[General Setwise Operations#ExclusiveOr|exclusive or]]) operations, or are irreversible, for instance a sequence of addition and conjunction (add, and) of move aspects, to update [[En passant|ep state]], [[Castling Rights|castling rights]] and the [[Halfmove Clock|halfmove clock]]. |
=Update= | =Update= | ||
− | Aspects of a position altered by reversible operations may be kept in global structures, shared by all nodes of the [[Search Tree|tree]], for instance square centric [[Mailbox|mailbox]] board arrays or [[Bitboard Board-Definition|bitboard board-definition]], and require [[Incremental Updates|incremental updates]] by make '''and''' [[Unmake Move|unmake]]. Irreversible aspects of the position, which can not generally restored from a child-position by unmaking a move, need to be restored by either re-playing the whole game record from the root position (too slow), or to be memorized inside an array indexed by [[Ply|ply]] or on a [[Stack|stack]] ([https://en.wikipedia.org/wiki/LIFO_%28computing%29 LIFO]), most notably [[En passant|ep state]], [[Castling | + | Aspects of a position altered by reversible operations may be kept in global structures, shared by all nodes of the [[Search Tree|tree]], for instance square centric [[Mailbox|mailbox]] board arrays or [[Bitboard Board-Definition|bitboard board-definition]], and require [[Incremental Updates|incremental updates]] by make '''and''' [[Unmake Move|unmake]]. Irreversible aspects of the position, which can not generally restored from a child-position by unmaking a move, need to be restored by either re-playing the whole game record from the root position (too slow), or to be memorized inside an array indexed by [[Ply|ply]] or on a [[Stack|stack]] ([https://en.wikipedia.org/wiki/LIFO_%28computing%29 LIFO]), most notably [[En passant|ep state]], [[Castling Rights|castling rights]] and the [[Halfmove Clock|halfmove clock]] enforcing the [[Fifty-move Rule|fifty-move rule]]. |
All those aspects of a position, no matter if reversible by unmake or not, which may need random access in a branch of moves from the [[Root|root]] (or initial position of the game) to the current position inside a certain implementation of a search algorithm, require an array of those aspects, indexed by ply, and updated by a [[Copy-Make]] approach. | All those aspects of a position, no matter if reversible by unmake or not, which may need random access in a branch of moves from the [[Root|root]] (or initial position of the game) to the current position inside a certain implementation of a search algorithm, require an array of those aspects, indexed by ply, and updated by a [[Copy-Make]] approach. |
Revision as of 21:38, 15 May 2018
Home * Chess * Moves * Make Move
Make Move is a function inside a chess program to update the internal chess position and its board representation as well as associated or dependent state variables and data by a move made on the internal board, such as zobrist keys to index the transposition table. That usually happens inside the Search algorithm, where the move acts like an edge connecting two nodes of a search tree, a parent and a child node. Dependent on the design of the data structures and the used search algorithms there are different approaches with respect to randomly accessing aspects of nodes and restoring the position while unmaking the move.
Contents
Operations
The general arithmetical and/or bitwise-logical operations to convert a node to its child are either reversible (even for irreversible moves), by inverse (e.g. addition and subtraction) or own inverse (exclusive or) operations, or are irreversible, for instance a sequence of addition and conjunction (add, and) of move aspects, to update ep state, castling rights and the halfmove clock.
Update
Aspects of a position altered by reversible operations may be kept in global structures, shared by all nodes of the tree, for instance square centric mailbox board arrays or bitboard board-definition, and require incremental updates by make and unmake. Irreversible aspects of the position, which can not generally restored from a child-position by unmaking a move, need to be restored by either re-playing the whole game record from the root position (too slow), or to be memorized inside an array indexed by ply or on a stack (LIFO), most notably ep state, castling rights and the halfmove clock enforcing the fifty-move rule.
All those aspects of a position, no matter if reversible by unmake or not, which may need random access in a branch of moves from the root (or initial position of the game) to the current position inside a certain implementation of a search algorithm, require an array of those aspects, indexed by ply, and updated by a Copy-Make approach.
See also
- Bitboard Update By Move
- Copy-Make
- Encoding Moves
- Incremental Updates
- Piece-List Update by Make Move
- Unmake Move
Forum Posts
- doing undoing by Fritz Reul, CCC, May 14, 2007
- performance of copy-make by Rein Halbersma, CCC, August 02, 2011
- Saving info before making a move by CDaley11, OpenChess Forum, December 30, 2013