MoveGenerator

dicechess.engine.movegen.MoveGenerator
object MoveGenerator

Unified move generator for Dice Chess. Coordinates between specialized generators for pawns, leapers, and sliding pieces.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def generateAllMoves(state: GameState): List[Move]

Generates all pseudo-legal moves for all pieces of the active color (standard chess).

Generates all pseudo-legal moves for all pieces of the active color (standard chess).

Iterates over every PieceType and concatenates the results of generatePieceMoves. Useful for perft testing and for positions where a dice roll is not applicable.

Value parameters

state

current game state

Attributes

Returns

combined pseudo-legal move list for all piece types

def generateMoves(state: GameState, diceRoll: Int): List[Move]

Generates all pseudo-legal moves for the active color and a given dice roll.

Generates all pseudo-legal moves for the active color and a given dice roll.

Maps the dice roll to a PieceType via PieceType.fromDice and delegates to generatePieceMoves. Returns Nil immediately for invalid rolls (0 or 7+).

Value parameters

diceRoll

value in [1, 6]; values outside this range yield an empty list

state

current game state

Attributes

Returns

pseudo-legal moves for the piece type indicated by the dice roll

def isSquareAttacked(state: GameState, sq: Square, attackerColor: Color): Bitboard

Returns the set of attackerColor pieces that attack sq, or an empty bitboard if none do.

Returns the set of attackerColor pieces that attack sq, or an empty bitboard if none do.

Checks attack patterns in priority order: pawns → knights → diagonal sliders (bishop/queen) → orthogonal sliders (rook/queen) → king. Returns the first non-empty attacker set found, which is sufficient for legality checks.

Used for castling path safety and king-in-check detection.

Value parameters

attackerColor

the color whose pieces may be attacking sq

sq

the square to test

state

current game state

Attributes

Returns

bitboard of attacking pieces, or Bitboard.empty if the square is safe