KingThreat
dicechess.engine.search.KingThreat
object KingThreat
Answers which rolls let the side to move capture the king on a target square within up to N actions (N = 1, 2, or 3), computed as the total weight of the matching rolls out of DiceRolls.totalOrderedRolls (216).
Unlike roll-by-roll search, this explores paths across all rolls in a single traversal from the position before the roll:
- Without dice in the position, pseudo-legal moves for every piece type are considered;
- Each path tracking towards the target square notes the dice it spends (castling spends King and Rook, a normal move spends its mover piece's die);
- Roll coverage is tracked as a 56-bit bitmask over the 56 distinct rolls in DiceRolls.weighted;
- Branches whose possible dice combinations are already fully covered by shorter or existing paths are pruned;
- Transpositions by (board Zobrist hash, spent dice key) are detected and skipped;
- Terminal captures at maximum depth use direct attacker bitboards without allocating full move lists;
- Once all 56 rolls are covered, the search terminates immediately with the maximum weight 216.
Attributes
- Source
- KingThreat.scala
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
KingThreat.type
Members list
In this article