Difference between revisions of "Legal Move"

From Chessprogramming wiki
Jump to: navigation, search
(Created page with "'''Home * Chess * Moves * Legal Move''' FILE:The_King_Can_Never_Be_Captured.jpg|border|right|thumb|link=https://fineartamerica.com/featured/the-king-c...")
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
  
 
[[FILE:The_King_Can_Never_Be_Captured.jpg|border|right|thumb|link=https://fineartamerica.com/featured/the-king-can-never-be-captured-marina-kalinovsky.html
 
[[FILE:The_King_Can_Never_Be_Captured.jpg|border|right|thumb|link=https://fineartamerica.com/featured/the-king-can-never-be-captured-marina-kalinovsky.html
| [[Arts#Kalinovsky|Marina Kalinovsky]] - The King can never be Captured <ref>[https://fineartamerica.com/featured/the-king-can-never-be-captured-marina-kalinovsky.html The King can never be Captured by Marina Kalinovsky, Artwork for Sale - Brooklyn, NY - United States]</ref> ]]  
+
| [[:Category:Marina Kalinovsky|Marina Kalinovsky]] - The King can never be Captured <ref>[https://fineartamerica.com/featured/the-king-can-never-be-captured-marina-kalinovsky.html The King can never be Captured by Marina Kalinovsky, Artwork for Sale - Brooklyn, NY - United States]</ref> ]]  
  
 
A '''Legal Move''' is a [[Pseudo-Legal Move|pseudo-legal move]] which does not leave its own [[King|king]] in [[Check|check]]. If not in check, most programs delay the legality test to the child node, after [[Incremental Updates|incremental updates]]  [[Attack and Defend Maps|attack and defend maps]] or an explicit [[Square Attacked By|square attacked test]] direct after [[Make Move|make move]]. Earlier programs were even more "lazy", to determine illegal moves after an illegal king capture, while many programs consider [[Pin#AbsolutePin|absolutely pinned]] pieces in [[Move Generation|move generation]] and also for [[Evaluation|evaluation]] purpose, or even perform a strictly legal generation to demand searching legal positions. If in check, most programs apply a special move generator to omit the majority of illegal moves.  
 
A '''Legal Move''' is a [[Pseudo-Legal Move|pseudo-legal move]] which does not leave its own [[King|king]] in [[Check|check]]. If not in check, most programs delay the legality test to the child node, after [[Incremental Updates|incremental updates]]  [[Attack and Defend Maps|attack and defend maps]] or an explicit [[Square Attacked By|square attacked test]] direct after [[Make Move|make move]]. Earlier programs were even more "lazy", to determine illegal moves after an illegal king capture, while many programs consider [[Pin#AbsolutePin|absolutely pinned]] pieces in [[Move Generation|move generation]] and also for [[Evaluation|evaluation]] purpose, or even perform a strictly legal generation to demand searching legal positions. If in check, most programs apply a special move generator to omit the majority of illegal moves.  
Line 36: Line 36:
 
* [http://www.open-chess.org/viewtopic.php?f=5&t=2697 En-passant legality test] by tetra, [[Computer Chess Forums|OpenChess Forum]], August 07, 2014 » [[En passant]]
 
* [http://www.open-chess.org/viewtopic.php?f=5&t=2697 En-passant legality test] by tetra, [[Computer Chess Forums|OpenChess Forum]], August 07, 2014 » [[En passant]]
 
* [http://www.talkchess.com/forum/viewtopic.php?t=63090 TTMove legality checking ? & Killers Move Format?] by [[Mahmoud Uthman]], [[CCC]], February 08, 2017 » [[Hash Move]], [[Killer Move]]
 
* [http://www.talkchess.com/forum/viewtopic.php?t=63090 TTMove legality checking ? & Killers Move Format?] by [[Mahmoud Uthman]], [[CCC]], February 08, 2017 » [[Hash Move]], [[Killer Move]]
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=73479 I just discovered a design flaw in my engine] by [[Michael Sherwin]], [[CCC]], March 27, 2020
  
 
=References=
 
=References=
Line 41: Line 42:
  
 
'''[[Moves|Up one Level]]'''
 
'''[[Moves|Up one Level]]'''
 +
[[Category:Marina Kalinovsky]]

Revision as of 21:08, 28 March 2020

Home * Chess * Moves * Legal Move

Marina Kalinovsky - The King can never be Captured [1]

A Legal Move is a pseudo-legal move which does not leave its own king in check. If not in check, most programs delay the legality test to the child node, after incremental updates attack and defend maps or an explicit square attacked test direct after make move. Earlier programs were even more "lazy", to determine illegal moves after an illegal king capture, while many programs consider absolutely pinned pieces in move generation and also for evaluation purpose, or even perform a strictly legal generation to demand searching legal positions. If in check, most programs apply a special move generator to omit the majority of illegal moves.

Legality Test

Beside the pseudo-legal condition which might already be sufficient for a subset of chess programs, there are several conditions to test, dependent whether the king is in check or not.

Not in Check

King in Check

Double Check

  • Only king moves to non attacked squares, sliding check x-rays the king

Single Check

  • Capture of checking piece. The capturing piece is not absolutely pinned
  • King moves to non attacked squares, sliding check x-rays the king
  • Interposing moves in case of distant sliding check. The moving piece is not absolutely pinned.

See also

Forum Posts

References

Up one Level