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 Objecttrait Matchableclass Any
- Self type
-
PawnGeneration.type
Members list
Value members
Concrete methods
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
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
singlePushesmethod.
Attributes
- Returns
-
A Bitboard of the squares the pawns will land on after a double push.
- Source
- PawnGeneration.scala
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
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
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
singlePushesoreastCaptures).
Attributes
- Returns
-
Bitboard of targets that land on the promotion rank.
- Source
- PawnGeneration.scala
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
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