PawnGeneration

dicechess.engine.movegen.PawnGeneration

Highly optimized pawn move generation using Bitboard arithmetic.

Unlike leaping pieces which are generated per-square, pawn pushes and attacks can be calculated in parallel for all pawns of a given color simultaneously using bitwise shifts.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

inline def anyAttacks(pawns: Bitboard, color: Color): Bitboard

Computes all attacked squares by pawns, regardless of whether there is an enemy there. Used primarily to determine if the King is in check or squares are unsafe.

Computes all attacked squares by pawns, regardless of whether there is an enemy there. Used primarily to determine if the King is in check or squares are unsafe.

Attributes

inline def doublePushes(singlePushes: Bitboard, emptySquares: Bitboard, color: Color): Bitboard

Computes the double forward push for all pawns starting from their initial rank.

Computes the double forward push for all pawns starting from their initial rank.

Value parameters

emptySquares

Bitboard of all currently empty squares.

singlePushes

The result of the singlePushes method.

Attributes

Returns

A Bitboard of the squares the pawns will land on after a double push.

inline def eastCaptures(pawns: Bitboard, enemies: Bitboard, color: Color): Bitboard

Computes all diagonal captures towards the East (H-file).

Computes all diagonal captures towards the East (H-file).

Value parameters

enemies

Bitboard of enemy pieces (or En Passant target).

pawns

Bitboard of pawns.

Attributes

inline def nonPromotionSquares(targets: Bitboard, color: Color): Bitboard

Filters a target bitboard, returning only the squares that are not on the promotion rank for the given color.

Filters a target bitboard, returning only the squares that are not on the promotion rank for the given color.

Value parameters

color

The color of the moving pawns.

targets

Bitboard of candidate target squares.

Attributes

Returns

Bitboard of targets that do not land on the promotion rank.

inline def promotionSquares(targets: Bitboard, color: Color): Bitboard

Filters a target bitboard, returning only the squares on the promotion rank for the given color.

Filters a target bitboard, returning only the squares on the promotion rank for the given color.

White promotes on Rank 8; Black promotes on Rank 1.

Value parameters

color

The color of the moving pawns.

targets

Bitboard of candidate target squares (e.g. result of singlePushes or eastCaptures).

Attributes

Returns

Bitboard of targets that land on the promotion rank.

inline def singlePushes(pawns: Bitboard, emptySquares: Bitboard, color: Color): Bitboard

Computes the single forward push for all pawns.

Computes the single forward push for all pawns.

Value parameters

emptySquares

Bitboard of all currently empty squares.

pawns

Bitboard of all pawns of the given color.

Attributes

Returns

A Bitboard of the squares the pawns will land on after a single push.

inline def westCaptures(pawns: Bitboard, enemies: Bitboard, color: Color): Bitboard

Computes all diagonal captures towards the West (A-file).

Computes all diagonal captures towards the West (A-file).

Value parameters

enemies

Bitboard of enemy pieces (or En Passant target).

pawns

Bitboard of pawns.

Attributes