Documentation ¶
Overview ¶
Package types contains various user defined data types and their corresponding functionality we need for the chess engine. Many of these would be perfect enum candidates but GO does not provide enums
Index ¶
- Constants
- Variables
- func FileDistance(f1 File, f2 File) int
- func RankDistance(r1 Rank, r2 Rank) int
- func SquareDistance(s1 Square, s2 Square) int
- type Bitboard
- func GetAttacksBb(pt PieceType, sq Square, occupied Bitboard) Bitboard
- func GetMovesDiagDown(square Square, content Bitboard) Bitboard
- func GetMovesDiagDownRotated(sq Square, rotated Bitboard) Bitboard
- func GetMovesDiagUp(sq Square, content Bitboard) Bitboard
- func GetMovesDiagUpRotated(sq Square, rotated Bitboard) Bitboard
- func GetMovesOnFile(sq Square, content Bitboard) Bitboard
- func GetMovesOnFileRotated(sq Square, rotated Bitboard) Bitboard
- func GetMovesOnRank(sq Square, content Bitboard) Bitboard
- func GetPawnAttacks(c Color, sq Square) Bitboard
- func GetPseudoAttacks(pt PieceType, sq Square) Bitboard
- func Intermediate(sq1 Square, sq2 Square) Bitboard
- func KingSideCastleMask(c Color) Bitboard
- func PopSquare(b Bitboard, s Square) Bitboard
- func PushSquare(b Bitboard, s Square) Bitboard
- func QueenSideCastMask(c Color) Bitboard
- func RotateL45(b Bitboard) Bitboard
- func RotateL90(b Bitboard) Bitboard
- func RotateR45(b Bitboard) Bitboard
- func RotateR90(b Bitboard) Bitboard
- func ShiftBitboard(b Bitboard, d Direction) Bitboard
- func SquaresBb(c Color) Bitboard
- func (b Bitboard) Has(s Square) bool
- func (b Bitboard) Lsb() Square
- func (b Bitboard) Msb() Square
- func (b Bitboard) PopCount() int
- func (b *Bitboard) PopLsb() Square
- func (b *Bitboard) PopSquare(s Square) Bitboard
- func (b *Bitboard) PushSquare(s Square) Bitboard
- func (b Bitboard) String() string
- func (b Bitboard) StringBoard() string
- func (b Bitboard) StringGrouped() string
- type CastlingRights
- type Color
- type Direction
- type File
- type Magic
- type Move
- func (m Move) From() Square
- func (m Move) IsValid() bool
- func (m Move) MoveOf() Move
- func (m Move) MoveType() MoveType
- func (m Move) PromotionType() PieceType
- func (m *Move) SetValue(v Value) Move
- func (m Move) String() string
- func (m Move) StringBits() string
- func (m Move) StringUci() string
- func (m Move) To() Square
- func (m Move) ValueOf() Value
- type MoveType
- type Orientation
- type Piece
- type PieceType
- type PrnG
- type Rank
- type Score
- type Square
- func (sq Square) Bb() Bitboard
- func (sq Square) CenterDistance() int
- func (sq Square) FileEastMask() Bitboard
- func (sq Square) FileOf() File
- func (sq Square) FileWestMask() Bitboard
- func (sq Square) FilesEastMask() Bitboard
- func (sq Square) FilesWestMask() Bitboard
- func (sq Square) Intermediate(sqTo Square) Bitboard
- func (sq Square) IsValid() bool
- func (sq Square) NeighbourFilesMask() Bitboard
- func (sq Square) PassedPawnMask(c Color) Bitboard
- func (sq Square) RankOf() Rank
- func (sq Square) RanksNorthMask() Bitboard
- func (sq Square) RanksSouthMask() Bitboard
- func (sq Square) Ray(o Orientation) Bitboard
- func (sq Square) String() string
- func (sq Square) To(d Direction) Square
- type Value
- type ValueType
Constants ¶
const ( BbZero = Bitboard(0) BbAll = ^BbZero BbOne = Bitboard(1) FileA_Bb Bitboard = 0x0101010101010101 FileB_Bb = FileA_Bb << 1 FileC_Bb = FileA_Bb << 2 FileD_Bb = FileA_Bb << 3 FileE_Bb = FileA_Bb << 4 FileF_Bb = FileA_Bb << 5 FileG_Bb = FileA_Bb << 6 FileH_Bb = FileA_Bb << 7 Rank1_Bb Bitboard = 0xFF Rank2_Bb = Rank1_Bb << (8 * 1) Rank3_Bb = Rank1_Bb << (8 * 2) Rank4_Bb = Rank1_Bb << (8 * 3) Rank5_Bb = Rank1_Bb << (8 * 4) Rank6_Bb = Rank1_Bb << (8 * 5) Rank7_Bb = Rank1_Bb << (8 * 6) Rank8_Bb = Rank1_Bb << (8 * 7) MsbMask = ^(Bitboard(1) << 63) Rank8Mask = ^Rank8_Bb FileAMask = ^FileA_Bb FileHMask = ^FileH_Bb DiagUpA1 Bitboard = 0b10000000_01000000_00100000_00010000_00001000_00000100_00000010_00000001 DiagUpB1 = (MsbMask & DiagUpA1) << 1 & FileAMask // shift EAST DiagUpC1 = (MsbMask & DiagUpB1) << 1 & FileAMask DiagUpD1 = (MsbMask & DiagUpC1) << 1 & FileAMask DiagUpE1 = (MsbMask & DiagUpD1) << 1 & FileAMask DiagUpF1 = (MsbMask & DiagUpE1) << 1 & FileAMask DiagUpG1 = (MsbMask & DiagUpF1) << 1 & FileAMask DiagUpH1 = (MsbMask & DiagUpG1) << 1 & FileAMask DiagUpA2 = (Rank8Mask & DiagUpA1) << 8 // shift NORTH DiagUpA3 = (Rank8Mask & DiagUpA2) << 8 DiagUpA4 = (Rank8Mask & DiagUpA3) << 8 DiagUpA5 = (Rank8Mask & DiagUpA4) << 8 DiagUpA6 = (Rank8Mask & DiagUpA5) << 8 DiagUpA7 = (Rank8Mask & DiagUpA6) << 8 DiagUpA8 = (Rank8Mask & DiagUpA7) << 8 DiagDownH1 Bitboard = 0b0000000100000010000001000000100000010000001000000100000010000000 DiagDownH2 = (Rank8Mask & DiagDownH1) << 8 // shift NORTH DiagDownH3 = (Rank8Mask & DiagDownH2) << 8 DiagDownH4 = (Rank8Mask & DiagDownH3) << 8 DiagDownH5 = (Rank8Mask & DiagDownH4) << 8 DiagDownH6 = (Rank8Mask & DiagDownH5) << 8 DiagDownH7 = (Rank8Mask & DiagDownH6) << 8 DiagDownH8 = (Rank8Mask & DiagDownH7) << 8 DiagDownG1 = (DiagDownH1 >> 1) & FileHMask // shift WEST DiagDownF1 = (DiagDownG1 >> 1) & FileHMask DiagDownE1 = (DiagDownF1 >> 1) & FileHMask DiagDownD1 = (DiagDownE1 >> 1) & FileHMask DiagDownC1 = (DiagDownD1 >> 1) & FileHMask DiagDownB1 = (DiagDownC1 >> 1) & FileHMask DiagDownA1 = (DiagDownB1 >> 1) & FileHMask CenterFiles = FileD_Bb | FileE_Bb CenterRanks = Rank4_Bb | Rank5_Bb CenterSquares = CenterFiles & CenterRanks )
Various constant bitboards
const ( CastlingNone CastlingRights = 0 // 0000 CastlingWhiteOO CastlingRights = 1 // 0001 CastlingWhiteOOO = CastlingWhiteOO << 1 // 0010 CastlingWhite = CastlingWhiteOO | CastlingWhiteOOO // 0011 CastlingBlackOO = CastlingWhiteOO << 2 // 0100 CastlingBlackOOO = CastlingBlackOO << 1 // 1000 CastlingBlack = CastlingBlackOO | CastlingBlackOOO // 1100 CastlingAny = CastlingWhite | CastlingBlack // 1111 CastlingRightsLength CastlingRights = 16 )
Constants for Castling
const ( White Color = 0 Black Color = 1 ColorLength int = 2 )
Constants for each color
const ( // SqLength number of squares on a board SqLength int = 64 // MaxDepth max search depth MaxDepth = 128 // MaxMoves max number of moves for a game MaxMoves = 512 // KB = 1.024 bytes KB uint64 = 1024 // MB = KB * KB MB = KB * KB // GB = KB * MB GB = KB * MB // GamePhaseMax maximum game phase value. Game phase is used to // determine if we are in the beginning or end phase of a chess game // Game phase is calculated be the number of officers on the board // with this maximum GamePhaseMax = 24 )
const ( ValueZero Value = 0 ValueDraw Value = 0 ValueOne Value = 1 ValueInf Value = 15_000 ValueNA = -ValueInf - 1 ValueMax Value = 10_000 ValueMin = -ValueMax ValueCheckMate = ValueMax ValueCheckMateThreshold = ValueCheckMate - MaxDepth - 1 )
Constants for values
const ( Vnone ValueType = 0 EXACT ValueType = 1 ALPHA ValueType = 2 // upper bound BETA ValueType = 3 // lower bound Vlength int = 4 )
ValueType is a set of constants for value types used in search and TtTable noinspection GoVarAndConstTypeMayBeOmitted
Variables ¶
Functions ¶
func FileDistance ¶
FileDistance returns the absolute distance in squares between two files
func RankDistance ¶
RankDistance returns the absolute distance in squares between two ranks
func SquareDistance ¶
SquareDistance returns the absolute distance in squares between two squares
Types ¶
type Bitboard ¶
type Bitboard uint64
Bitboard is a 64 bit unsigned int with 1 bit for each square on the board
func GetAttacksBb ¶
GetAttacksBb returns a bitboard representing all the squares attacked by a piece of the given type pt (not pawn) placed on 'sq'. For sliding pieces this uses the pre-computed Magic Bitboard Attack arrays. For Knight and King this the occupied Bitboard is ignored (can be BbZero) as for these non sliders the pre-computed pseudo attacks are used
func GetMovesDiagDown ¶
GetMovesDiagDown Bb for all possible diagonal up moves of the square with the content (blocking pieces) determined from the given non rotated bitboard.
Deprecated use GetAttacksBb(pt PieceType, sq Square, occupied Bitboard)
func GetMovesDiagDownRotated ¶
GetMovesDiagDownRotated Bb for all possible diagonal up moves of the square with the content (blocking pieces) determined from the given L45 rotated bitboard.
Deprecated use GetAttacksBb(pt PieceType, sq Square, occupied Bitboard)
func GetMovesDiagUp ¶
GetMovesDiagUp Bb for all possible diagonal up moves of the square with the content (blocking pieces) determined from the given non rotated bitboard.
Deprecated use GetAttacksBb(pt PieceType, sq Square, occupied Bitboard)
func GetMovesDiagUpRotated ¶
GetMovesDiagUpRotated Bb for all possible diagonal up moves of the square with the content (blocking pieces) determined from the given R45 rotated bitboard.
Deprecated use GetAttacksBb(pt PieceType, sq Square, occupied Bitboard)
func GetMovesOnFile ¶
GetMovesOnFile Bb for all possible horizontal moves on the rank of the square with the rank content (blocking pieces) determined from the given bitboard (not rotated - use GetMovesOnFileRotated for already rotated bitboards)
Deprecated use GetAttacksBb(pt PieceType, sq Square, occupied Bitboard)
func GetMovesOnFileRotated ¶
GetMovesOnFileRotated Bb for all possible horizontal moves on the rank of the square with the rank content (blocking pieces) determined from the given L90 rotated bitboard.
Deprecated use GetAttacksBb(pt PieceType, sq Square, occupied Bitboard)
func GetMovesOnRank ¶
GetMovesOnRank returns a Bb for all possible horizontal moves on the rank of the square with the rank content (blocking pieces) determined from the given pieces bitboard.
Deprecated use GetAttacksBb(pt PieceType, sq Square, occupied Bitboard)
func GetPawnAttacks ¶
GetPawnAttacks returns a Bb of possible attacks of a pawn
func GetPseudoAttacks ¶
GetPseudoAttacks returns a Bb of possible attacks of a piece as if on an empty board
func Intermediate ¶
Intermediate returns a Bb of squares between the given two squares
func KingSideCastleMask ¶
KingSideCastleMask returns a Bb with the kings side squares used in castling without the king square
func PushSquare ¶
PushSquare sets the corresponding bit of the bitboard for the square
func QueenSideCastMask ¶
QueenSideCastMask returns a Bb with the queen side squares used in castling without the king square
func RotateL45 ¶
RotateL45 rotates a Bb by 45 degrees counter clockwise to get all downward diagonals in compact block of bits This is used to create a mask to find moves for queen and bishop on the downward diagonal
func RotateR45 ¶
RotateR45 rotates a Bb by 45 degrees clockwise to get all upward diagonals in compact block of bits This is used to create a mask to find moves for queen and bishop on the upward diagonal
func ShiftBitboard ¶
ShiftBitboard shifting all bits of a bitboard in the given direction by 1 square
func SquaresBb ¶
SquaresBb returns a Bb of all squares of the given color. E.g. can be used to find bishops of the same "color" for draw detection.
func (Bitboard) Lsb ¶
Lsb returns the least significant bit of the 64-bit Bb. This translates directly to the Square which is returned. If the bitboard is empty SqNone will be returned. Lsb() indexes from 0-63 - 0 being the the lsb and equal to SqA1
func (Bitboard) Msb ¶
Msb returns the most significant bit of the 64-bit Bb. This translates directly to the Square which is returned. If the bitboard is empty SqNone will be returned. Msb() indexes from 0-63 - 63 being the the msb and equal to SqH8
func (Bitboard) PopCount ¶
PopCount returns the number of one bits ("population count") in b. This equals the number of squares set in a Bitboard
func (*Bitboard) PopLsb ¶
PopLsb returns the Lsb square and removes it from the bitboard. The given bitboard is changed directly.
func (*Bitboard) PushSquare ¶
PushSquare sets the corresponding bit of the bitboard for the square
func (Bitboard) StringBoard ¶
StringBoard returns a string representation of the Bb as a board off 8x8 squares
func (Bitboard) StringGrouped ¶
StringGrouped returns a string representation of the 64 bits grouped in 8. Order is LSB to msb ==> A1 B1 ... G8 H8
type CastlingRights ¶
type CastlingRights uint8
CastlingRights encodes the castling state e.g. available castling and defines functions to change this state
func GetCastlingRights ¶
func GetCastlingRights(sq Square) CastlingRights
GetCastlingRights returns the CastlingRights for changes on this square.
func (*CastlingRights) Add ¶
func (cr *CastlingRights) Add(rhs CastlingRights) CastlingRights
Add adds a castling right ti the state
func (CastlingRights) Has ¶
func (cr CastlingRights) Has(rhs CastlingRights) bool
Has checks if the state has the bit for the Castling right set and therefore this castling is available
func (*CastlingRights) Remove ¶
func (cr *CastlingRights) Remove(rhs CastlingRights) CastlingRights
Remove removes a castling right from the input state (deletes right)
func (CastlingRights) String ¶
func (cr CastlingRights) String() string
String returns a string representation for the castling right instance which can be used directly in a fen (e.g. "KQkq")
type Color ¶
type Color uint8
Color represents constants for each chess color White and Black
func (Color) MoveDirection ¶
MoveDirection returns the direction of a pawn move for the color
func (Color) PawnDoubleRank ¶
PawnDoubleRank returns the rank from which the given color might make a second pawn push to achieve a pawn double move
func (Color) PromotionRankBb ¶
PromotionRankBb returns the rank on which the given color promotes
type Direction ¶
type Direction int8
Direction is a set of constants for moving squares within a Bb
const ( North Direction = 8 East Direction = 1 South Direction = -North West Direction = -East Northeast Direction = North + East Southeast Direction = South + East Southwest Direction = South + West Northwest Direction = North + West )
Direction is a set of constants for moving squares within a Bb noinspection GoVarAndConstTypeMayBeOmitted
type File ¶
type File uint8
File represents a chess board file a-h
type Magic ¶
Magic holds all magic bitboards relevant for a single square Taken from Stockfish License see https://stockfishchess.org/about/
type Move ¶
type Move uint32
Move is a 32bit unsigned int type for encoding chess moves as a primitive data type 16 bits for move encoding - 16 bits for sort value
const ( // MoveNone empty non valid move MoveNone Move = 0 )
func CreateMove ¶
CreateMove returns an encoded Move instance
func CreateMoveValue ¶
CreateMoveValue returns an encoded Move instance including a sort value
func (Move) IsValid ¶
IsValid check if the move has valid squares, promotion type and move type. MoveNone is not a valid move in this sense.
func (Move) MoveType ¶
MoveType returns the type of the move as defined in MoveType Normal, Promotion, EnPassant, Castling
func (Move) PromotionType ¶
PromotionType returns the PieceType considered for promotion when move type is also MoveType.Promotion. Must be ignored when move type is not MoveType.Promotion.
func (Move) StringBits ¶
StringBits returns a string with details of a Move E.g. Move { From[001100](e2) To[011100](e4) Prom[11](N) tType[00](n) value[0000000000000000](0) (796)}
type MoveType ¶
type MoveType uint
MoveType is used for the different move types we use to encode moves. Values are Normal, Promotion, EnPassant, Castling
MoveType constants
type Orientation ¶
type Orientation uint8
Orientation is a set of constants for directions from a squares
const ( NW Orientation = 0 N Orientation = 1 NE Orientation = 2 E Orientation = 3 SE Orientation = 4 S Orientation = 5 SW Orientation = 6 W Orientation = 7 )
Orientation is a set of constants for moving squares within a Bb noinspection GoVarAndConstTypeMayBeOmitted
func (Orientation) IsValid ¶
func (o Orientation) IsValid() bool
IsValid tests if o is a valid Orientation value
func (Orientation) String ¶
func (d Orientation) String() string
String returns a string representation of a Orientation (e.g. N, E, ...,NW,...)
type Piece ¶
type Piece int8
Piece is a set of constants for pieces in chess
const ( PieceNone Piece = 0 WhiteKing Piece = 1 WhitePawn Piece = 2 WhiteKnight Piece = 3 WhiteBishop Piece = 4 WhiteRook Piece = 5 WhiteQueen Piece = 6 BlackKing Piece = 9 BlackPawn Piece = 10 BlackKnight Piece = 11 BlackBishop Piece = 12 BlackRook Piece = 13 BlackQueen Piece = 14 PieceLength Piece = 16 )
Pieces are a set of constants to represent the different pieces of a chess game.
Can be used with masks:
No Piece = 0 White Piece is a non zero value with piece & 0b1000 == 0 Black Piece is a non zero value with piece & 0b1000 == 1 PieceNone = 0b0000 WhiteKing = 0b0001 WhitePawn = 0b0010 WhiteKnight= 0b0011 WhiteBishop= 0b0100 WhiteRook = 0b0101 WhiteQueen = 0b0110 BlackKing = 0b1001 BlackPawn = 0b1010 BlackKnight= 0b1011 BlackBishop= 0b1100 BlackRook = 0b1101 BlackQueen = 0b1110 PieceLength= 0b10000
func PieceFromChar ¶
PieceFromChar returns the Piece corresponding to the given character. If s contains not exactly one character or if the character is invalid this will return PieceNone
func (Piece) Char ¶
Char returns a string representation of a piece type where pawns are O and * for white and black
type PieceType ¶
type PieceType int8
PieceType is a set of constants for piece types in chess
const ( PtNone PieceType = 0b0000 King PieceType = 0b0001 Pawn PieceType = 0b0010 Knight PieceType = 0b0011 Bishop PieceType = 0b0100 Rook PieceType = 0b0101 Queen PieceType = 0b0110 PtLength PieceType = 0b0111 )
PieceType is a set of constants for piece types in chess
test for non sliding pt & 0b0100 == 0 (must be none zero) test for sliding pt & 0b0100 == 1 (must be < 7) PtNone = 0b0000 King = 0b0001 // non sliding Pawn = 0b0010 // non sliding Knight = 0b0011 // non sliding Bishop = 0b0100 // sliding Rook = 0b0101 // sliding Queen = 0b0110 // sliding PtLength = 0b0111
func (PieceType) GamePhaseValue ¶
GamePhaseValue returns a value for calculating game phase by adding the number of certain piece type times this value
type PrnG ¶
type PrnG struct {
// contains filtered or unexported fields
}
PrnG random generator for magic bitboards from Stockfish xorshift64star Pseudo-Random Number Generator This class is based on original code written and dedicated to the public domain by Sebastiano Vigna (2014). It has the following characteristics:
- Outputs 64-bit numbers
- Passes Dieharder and SmallCrush test batteries
- Does not require warm-up, no zeroland to escape
- Internal state is a single 64-bit integer
- Period is 2^64 - 1
- Speed: 1.60 ns/call (Core i7 @3.40GHz)
For further analysis see
<http://vigna.di.unimi.it/ftp/papers/xorshift.pdf>
type Rank ¶
type Rank uint8
Rank represents a chess board rank 1-8
type Score ¶
Score is a small struct for mid game and end game values
func (*Score) ValueFromScore ¶
ValueFromScore adds up the mid and end games scores after multiplying them with the game phase factor
type Square ¶
type Square uint8
Square represent exactly on square on a chess board.
const ( SqA1 Square = iota // 0 SqB1 Square = iota // 1 SqC1 Square = iota SqD1 Square = iota SqE1 Square = iota SqF1 Square = iota SqG1 Square = iota SqH1 Square = iota SqA2 Square = iota SqB2 Square = iota SqC2 Square = iota SqD2 Square = iota SqE2 Square = iota SqF2 Square = iota SqG2 Square = iota SqH2 Square = iota SqA3 Square = iota SqB3 Square = iota SqC3 Square = iota SqD3 Square = iota SqE3 Square = iota SqF3 Square = iota SqG3 Square = iota SqH3 Square = iota SqA4 Square = iota SqB4 Square = iota SqC4 Square = iota SqD4 Square = iota SqE4 Square = iota SqF4 Square = iota SqG4 Square = iota SqH4 Square = iota SqA5 Square = iota SqB5 Square = iota SqC5 Square = iota SqD5 Square = iota SqE5 Square = iota SqF5 Square = iota SqG5 Square = iota SqH5 Square = iota SqA6 Square = iota SqB6 Square = iota SqC6 Square = iota SqD6 Square = iota SqE6 Square = iota SqF6 Square = iota SqG6 Square = iota SqH6 Square = iota SqA7 Square = iota SqB7 Square = iota SqC7 Square = iota SqD7 Square = iota SqE7 Square = iota SqF7 Square = iota SqG7 Square = iota SqH7 Square = iota SqA8 Square = iota SqB8 Square = iota SqC8 Square = iota SqD8 Square = iota SqE8 Square = iota SqF8 Square = iota SqG8 Square = iota SqH8 Square = iota // 63 SqNone Square = iota // 64 )
noinspection GoUnusedConst
func MakeSquare ¶
MakeSquare returns a square based on the string given or SqNone if no valid square could be read from the string
func RotateSquareL45 ¶
RotateSquareL45 maps squares to the sq of the rotated board. E.g. when rotating clockwise by 90 degree A1 becomes A8, A8 becomes H8, etc.
func RotateSquareL90 ¶
RotateSquareL90 maps squares to the sq of the rotated board. E.g. when rotating clockwise by 90 degree A1 becomes A8, A8 becomes H8, etc.
func RotateSquareR45 ¶
RotateSquareR45 maps squares to the sq of the rotated board. E.g. when rotating clockwise by 90 degree A1 becomes A8, A8 becomes H8, etc.
func RotateSquareR90 ¶
RotateSquareR90 maps squares to the sq of the rotated board. E.g. when rotating clockwise by 90 degree A1 becomes A8, A8 becomes H8, etc.
func SquareOf ¶
SquareOf returns a square from file and rank Returns SqNone for invalid files or ranks
func (Square) Bb ¶
Bb returns a Bitboard of the square by accessing the pre calculated square to bitboard array.
func (Square) CenterDistance ¶
CenterDistance returns the distance to the nearest center square
func (Square) FileEastMask ¶
FileEastMask returns a Bb of the file east of the square
func (Square) FileWestMask ¶
FileWestMask returns a Bb of the file west of the square
func (Square) FilesEastMask ¶
FilesEastMask returns a Bb of the files east of the square
func (Square) FilesWestMask ¶
FilesWestMask returns a Bb of the files west of the square
func (Square) Intermediate ¶
Intermediate returns a Bb of squares between the given two squares
func (Square) IsValid ¶
IsValid checks a value of type square if it represents a valid square on a chess board (e.q. sq < 64).
func (Square) NeighbourFilesMask ¶
NeighbourFilesMask returns a Bb of the file east and west of the square
func (Square) PassedPawnMask ¶
PassedPawnMask returns a Bitboards with all possible squares which have an opponents pawn which could stop this pawn. Use this mask and AND it with the opponents pawns bitboards to see if a pawn has passed.
func (Square) RanksNorthMask ¶
RanksNorthMask returns a Bb of the ranks north of the square
func (Square) RanksSouthMask ¶
RanksSouthMask returns a Bb of the ranks south of the square
func (Square) Ray ¶
func (sq Square) Ray(o Orientation) Bitboard
Ray returns a Bb of squares outgoing from the square in direction of the orientation
type Value ¶
type Value int16
Value represents the positional value of a chess position
func PosEndValue ¶
PosEndValue returns the pre computed positional value for the piece on the given square in end game
func PosMidValue ¶
PosMidValue returns the pre computed positional value for the piece on the given square in mid game
func PosValue ¶
PosValue returns the pre computed positional value for the piece on the given square and given game phase
func (Value) IsCheckMateValue ¶
IsCheckMateValue returns true if value is above the check mate threshold which typically is set to check mate value minus the maximum search depth