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

Source
PawnGeneration.scala
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.

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 for king placement. Unlike eastCaptures and westCaptures, this does not intersect with any enemy bitboard.

Value parameters

color

the color of the attacking pawns (determines shift direction)

pawns

Bitboard of pawns to compute attacks for.

Attributes

Returns

Bitboard of all squares attacked by the given pawns.

Source
PawnGeneration.scala
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.

Source
PawnGeneration.scala
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

color

the color of the attacking pawns (determines the direction of the attack)

enemies

Bitboard of enemy pieces (or En Passant target).

pawns

Bitboard of pawns.

Attributes

Returns

Bitboard of squares where a pawn can capture towards the H-file.

Source
PawnGeneration.scala
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.

Source
PawnGeneration.scala
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.

Source
PawnGeneration.scala
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.

Source
PawnGeneration.scala
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

color

the color of the attacking pawns (determines the direction of the attack)

enemies

Bitboard of enemy pieces (or En Passant target).

pawns

Bitboard of pawns.

Attributes

Returns

Bitboard of squares where a pawn can capture towards the A-file.

Source
PawnGeneration.scala