Check out Glinski's Hexagonal Chess, our featured variant for May, 2024.


[ Help | Earliest Comments | Latest Comments ]
[ List All Subjects of Discussion | Create New Subject of Discussion ]
[ List Earliest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]

Single Comment

Apothecary Chess Tournament[Subject Thread] [Add Response]
H. G. Muller wrote on Thu, Jan 14, 2021 09:22 AM UTC in reply to Aurelian Florea from 06:57 AM:

I must admit that this would currently also not work in presets generated by the Play-Testing Applet. At least for highlighting purposes: it also fails to update the 'last moved piece' when it tenttatively makes the move that might have to be highlighted in order to test if it exposes the King to capture. But if you decide to use the Applet-generated code, I can fix that.

To speed up fully-legal highlighting, I use a short-cut: Instead of trying all possible opponent moves to see if they capture the King, I only try those that might have been affected by the move of which we want to judge the legality. To that end it first marks all squares attaced by the opponent in the original position with its own King removed, and for every piece it makes a list of moves (origin and direction) that they obstruct. It also makes a list of pre-existing checking moves. After trying a move, it then only reruns the pre-existing checks in the resulting position (to see whether these are now resolved), plus the moves that were blocked by the moved piece (to check whether that piece was pinned). And for King moves it tests whether these go to a square that was marked as being under attack.

I suppose it would have to rerun all moves of an imitator too, because these are also affected by the preceding move. (And do the attacked-squares test in the initial position while imitating a King.)