basic

package
v0.0.0-...-f221fad Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Normal = MoveType(iota)
	Promotion
	SentryPush
	Castling
	Null
)
View Source
const (
	PopNull = iota
	GenAll
	PopAll
	GenDone
)

stack phases

View Source
const (
	NoMove = MoveKind(iota)
	Quiet
	Violent
)
View Source
const (
	NoFigure        = Figure(0)
	Pawn            = Figure(1)
	Knight          = Figure(2)
	Bishop          = Figure(3)
	Rook            = Figure(4)
	Queen           = Figure(5)
	King            = Figure(6)
	Lancer          = Figure(7)
	LancerN         = Figure(8)
	LancerNE        = Figure(9)
	LancerE         = Figure(10)
	LancerSE        = Figure(11)
	LancerS         = Figure(12)
	LancerSW        = Figure(13)
	LancerW         = Figure(14)
	LancerNW        = Figure(15)
	Sentry          = Figure(16)
	Jailer          = Figure(17)
	FigureArraySize = int(iota)
)
View Source
const (
	NoPiece       = Piece(0)
	DummyPiece    = Piece(1)
	BlackPawn     = Piece(2)
	WhitePawn     = Piece(3)
	BlackKnight   = Piece(4)
	WhiteKnight   = Piece(5)
	BlackBishop   = Piece(6)
	WhiteBishop   = Piece(7)
	BlackRook     = Piece(8)
	WhiteRook     = Piece(9)
	BlackQueen    = Piece(10)
	WhiteQueen    = Piece(11)
	BlackKing     = Piece(12)
	WhiteKing     = Piece(13)
	BlackLancer   = Piece(14)
	WhiteLancer   = Piece(15)
	BlackLancerN  = Piece(16)
	WhiteLancerN  = Piece(17)
	BlackLancerNE = Piece(18)
	WhiteLancerNE = Piece(19)
	BlackLancerE  = Piece(20)
	WhiteLancerE  = Piece(21)
	BlackLancerSE = Piece(22)
	WhiteLancerSE = Piece(23)
	BlackLancerS  = Piece(24)
	WhiteLancerS  = Piece(25)
	BlackLancerSW = Piece(26)
	WhiteLancerSW = Piece(27)
	BlackLancerW  = Piece(28)
	WhiteLancerW  = Piece(29)
	BlackLancerNW = Piece(30)
	WhiteLancerNW = Piece(31)
	BlackSentry   = Piece(32)
	WhiteSentry   = Piece(33)
	BlackJailer   = Piece(34)
	WhiteJailer   = Piece(35)
)
View Source
const (
	Black = Color(iota)
	White
	NoColor
	ColorArraySize = int(iota)
)
View Source
const (
	SquareA1 = Square(0)
	SquareB1 = Square(1)
	SquareC1 = Square(2)
	SquareD1 = Square(3)
	SquareE1 = Square(4)
	SquareF1 = Square(5)
	SquareG1 = Square(6)
	SquareH1 = Square(7)
	SquareA2 = Square(8)
	SquareB2 = Square(9)
	SquareC2 = Square(10)
	SquareD2 = Square(11)
	SquareE2 = Square(12)
	SquareF2 = Square(13)
	SquareG2 = Square(14)
	SquareH2 = Square(15)
	SquareA3 = Square(16)
	SquareB3 = Square(17)
	SquareC3 = Square(18)
	SquareD3 = Square(19)
	SquareE3 = Square(20)
	SquareF3 = Square(21)
	SquareG3 = Square(22)
	SquareH3 = Square(23)
	SquareA4 = Square(24)
	SquareB4 = Square(25)
	SquareC4 = Square(26)
	SquareD4 = Square(27)
	SquareE4 = Square(28)
	SquareF4 = Square(29)
	SquareG4 = Square(30)
	SquareH4 = Square(31)
	SquareA5 = Square(32)
	SquareB5 = Square(33)
	SquareC5 = Square(34)
	SquareD5 = Square(35)
	SquareE5 = Square(36)
	SquareF5 = Square(37)
	SquareG5 = Square(38)
	SquareH5 = Square(39)
	SquareA6 = Square(40)
	SquareB6 = Square(41)
	SquareC6 = Square(42)
	SquareD6 = Square(43)
	SquareE6 = Square(44)
	SquareF6 = Square(45)
	SquareG6 = Square(46)
	SquareH6 = Square(47)
	SquareA7 = Square(48)
	SquareB7 = Square(49)
	SquareC7 = Square(50)
	SquareD7 = Square(51)
	SquareE7 = Square(52)
	SquareF7 = Square(53)
	SquareG7 = Square(54)
	SquareH7 = Square(55)
	SquareA8 = Square(56)
	SquareB8 = Square(57)
	SquareC8 = Square(58)
	SquareD8 = Square(59)
	SquareE8 = Square(60)
	SquareF8 = Square(61)
	SquareG8 = Square(62)
	SquareH8 = Square(63)
)
View Source
const (
	Rank1 = Rank(0)
	Rank2 = Rank(1)
	Rank3 = Rank(2)
	Rank4 = Rank(3)
	Rank5 = Rank(4)
	Rank6 = Rank(5)
	Rank7 = Rank(6)
	Rank8 = Rank(7)
)
View Source
const (
	FileA = File(0)
	FileB = File(1)
	FileC = File(2)
	FileD = File(3)
	FileE = File(4)
	FileF = File(5)
	FileG = File(6)
	FileH = File(7)
)
View Source
const (
	VariantStandard = Variant(iota)
	VariantEightPiece
	VariantAtomic
)
View Source
const (
	CastlingSideKing = iota
	CastlingSideQueen
)
View Source
const (
	CastleWhiteKingIndex = iota
	CastleWhiteQueenIndex
	CastleBlackKingIndex
	CastleBlackQueenIndex
)
View Source
const (
	LANCER_DIRECTION_N = iota
	LANCER_DIRECTION_NE
	LANCER_DIRECTION_E
	LANCER_DIRECTION_SE
	LANCER_DIRECTION_S
	LANCER_DIRECTION_SW
	LANCER_DIRECTION_W
	LANCER_DIRECTION_NW
)
View Source
const ATTACK_MULTIPLIER = 25
View Source
const BISHOP_WIZARD_INDEX = 0
View Source
const BOARD_AREA = NUM_RANKS * NUM_FILES
View Source
const COLOR_MASK = White
View Source
const CastleArraySize = 4
View Source
const ColorMaxValue = NoColor
View Source
const ColorMinValue = 0
View Source
const FILE_MASK = (1 << FILE_STORAGE_SIZE_IN_BITS) - 1
View Source
const FILE_SHIFT_IN_BITS = 0
View Source
const FILE_STORAGE_SIZE_IN_BITS = 3
View Source
const FROM_SQUARE_SHIFT = 0 // 0
View Source
const FigureMaxValue = Jailer
View Source
const FigureMinValue = Pawn
View Source
const INFINITE_DEPTH = int8(SEARCH_MAX_DEPTH + 1)
View Source
const INFINITE_SCORE = Score(20000)
View Source
const INITIAL_MATERIAL = 2 * 4220
View Source
const LANCER_DIRECTION_MASK = 0b111
View Source
const LAST_FILE = NUM_FILES - 1
View Source
const LAST_RANK = NUM_RANKS - 1
View Source
const LOST_CASTLING_DEDUCTION = 50
View Source
const LancerMaxValue = LancerNW
View Source
const LancerMinValue = LancerN
View Source
const MATE_SCORE = Score(10000)
View Source
const MAX_MULTIPV = 20
View Source
const MAX_PV_MOVES = 4
View Source
const MAX_SCORE = 9000
View Source
const MAX_STATES = SEARCH_MAX_DEPTH + 1
View Source
const MIN_REDUCE_LIMIT = 8
View Source
const MOBILITY_MULTIPLIER = 10
View Source
const MOVE_TYPE_MASK = (1 << MOVE_TYPE_STORAGE_SIZE_IN_BITS) - 1
View Source
const MOVE_TYPE_STORAGE_SIZE_IN_BITS = 8
View Source
const NUM_FILES = 8
View Source
const NUM_LANCER_DIRECTIONS = 8
View Source
const NUM_RANKS = 8
View Source
const NullMove = Move(Null) << MOVE_TYPE_SHIFT
View Source
const PIECE_MASK = (1 << PIECE_STORAGE_SIZE_IN_BITS) - 1
View Source
const PIECE_STORAGE_SIZE_IN_BITS = 6
View Source
const POS_MOVE_HASH_KEY_SIZE_IN_BITS = 25
View Source
const POS_MOVE_HASH_MASK = PV_HASH_SIZE - 1
View Source
const POS_MOVE_HASH_SIZE = 1 << PV_HASH_KEY_SIZE_IN_BITS
View Source
const PROMOTION_PIECE_SHIFT = PROMOTION_SQUARE_SHIFT + SQUARE_STORAGE_SIZE_IN_BITS // 18
View Source
const PROMOTION_SQUARE_SHIFT = TO_SQUARE_SHIFT + SQUARE_STORAGE_SIZE_IN_BITS // 12
View Source
const PV_HASH_KEY_SIZE_IN_BITS = 20
View Source
const PV_HASH_MASK = PV_HASH_SIZE - 1
View Source
const PV_HASH_SIZE = 1 << PV_HASH_KEY_SIZE_IN_BITS
View Source
const PieceArraySize = PieceMaxValue - PieceMinValue + 1
View Source
const PieceMaxValue = WhiteJailer
View Source
const PieceMinValue = BlackPawn
View Source
const RANK_MASK = ((1 << RANK_STORAGE_SIZE_IN_BITS) - 1) << RANK_SHIFT_IN_BITS
View Source
const RANK_SHIFT_IN_BITS = FILE_STORAGE_SIZE_IN_BITS
View Source
const RANK_STORAGE_SIZE_IN_BITS = 3
View Source
const ROOK_WIZARD_INDEX = 1
View Source
const SEARCH_MAX_DEPTH = 100
View Source
const SQUARE_MASK = (1 << SQUARE_STORAGE_SIZE_IN_BITS) - 1
View Source
const SQUARE_STORAGE_SIZE_IN_BITS = RANK_STORAGE_SIZE_IN_BITS + FILE_STORAGE_SIZE_IN_BITS
View Source
const SquareMaxValue = SquareH8
View Source
const SquareMinValue = SquareA1
View Source
const TO_SQUARE_SHIFT = SQUARE_STORAGE_SIZE_IN_BITS // 6

Variables

View Source
var BISHOP_DELTAS = []Delta{{1, 1}, {1, -1}, {-1, 1}, {-1, -1}}
View Source
var BISHOP_MAGICS = Magics{
	{SquareA1, 7, 0x00400a4182001490, []Bitboard{}},
	{SquareB1, 7, 0x0010008829000c00, []Bitboard{}},
	{SquareC1, 7, 0x0044008180080000, []Bitboard{}},
	{SquareD1, 7, 0x0094220020000400, []Bitboard{}},
	{SquareE1, 7, 0x000048d600000100, []Bitboard{}},
	{SquareF1, 7, 0x0004300082601280, []Bitboard{}},
	{SquareG1, 7, 0x0044002208600801, []Bitboard{}},
	{SquareH1, 7, 0x0040602206d64000, []Bitboard{}},
	{SquareA2, 7, 0x0080461220884010, []Bitboard{}},
	{SquareB2, 7, 0x0044201800848010, []Bitboard{}},
	{SquareC2, 7, 0x0000404084224800, []Bitboard{}},
	{SquareD2, 7, 0x00008802c0400184, []Bitboard{}},
	{SquareE2, 7, 0x0000009040004002, []Bitboard{}},
	{SquareF2, 7, 0x000081c202240021, []Bitboard{}},
	{SquareG2, 7, 0x0001320082011000, []Bitboard{}},
	{SquareH2, 7, 0x000002e024020080, []Bitboard{}},
	{SquareA3, 7, 0x000102024c100440, []Bitboard{}},
	{SquareB3, 7, 0x0001044210020200, []Bitboard{}},
	{SquareC3, 7, 0x0008040400c40008, []Bitboard{}},
	{SquareD3, 8, 0x0000800042004800, []Bitboard{}},
	{SquareE3, 8, 0x0001000020080048, []Bitboard{}},
	{SquareF3, 8, 0x0000510028004800, []Bitboard{}},
	{SquareG3, 7, 0x000a000020806100, []Bitboard{}},
	{SquareH3, 7, 0x000020008c028480, []Bitboard{}},
	{SquareA4, 7, 0x0004040402018680, []Bitboard{}},
	{SquareB4, 7, 0x0009010020380110, []Bitboard{}},
	{SquareC4, 8, 0x0000100318004150, []Bitboard{}},
	{SquareD4, 12, 0x0004081404060002, []Bitboard{}},
	{SquareE4, 10, 0x0000108002100400, []Bitboard{}},
	{SquareF4, 9, 0x0008008020082000, []Bitboard{}},
	{SquareG4, 7, 0x00080a4000804440, []Bitboard{}},
	{SquareH4, 7, 0x0002402042148100, []Bitboard{}},
	{SquareA5, 7, 0x02009040e0080200, []Bitboard{}},
	{SquareB5, 7, 0x0002010090040808, []Bitboard{}},
	{SquareC5, 9, 0x0000080041220040, []Bitboard{}},
	{SquareD5, 11, 0x0000022604040100, []Bitboard{}},
	{SquareE5, 10, 0x0002004010080200, []Bitboard{}},
	{SquareF5, 8, 0x0008120020411000, []Bitboard{}},
	{SquareG5, 7, 0x000081c202240021, []Bitboard{}},
	{SquareH5, 7, 0x000a022048002201, []Bitboard{}},
	{SquareA6, 7, 0x0001648a10084840, []Bitboard{}},
	{SquareB6, 7, 0x0000842100802000, []Bitboard{}},
	{SquareC6, 8, 0x0201010020804200, []Bitboard{}},
	{SquareD6, 8, 0x0000002458000400, []Bitboard{}},
	{SquareE6, 7, 0x0000400091000200, []Bitboard{}},
	{SquareF6, 7, 0x0040080801200040, []Bitboard{}},
	{SquareG6, 7, 0x0003100502000a40, []Bitboard{}},
	{SquareH6, 7, 0x000102024c100440, []Bitboard{}},
	{SquareA7, 7, 0x0201008043202000, []Bitboard{}},
	{SquareB7, 7, 0x00080c1414040000, []Bitboard{}},
	{SquareC7, 7, 0x0282009040424800, []Bitboard{}},
	{SquareD7, 7, 0x0084400050120000, []Bitboard{}},
	{SquareE7, 7, 0x0000001002408000, []Bitboard{}},
	{SquareF7, 7, 0x0000042480604000, []Bitboard{}},
	{SquareG7, 7, 0x0070228302640200, []Bitboard{}},
	{SquareH7, 7, 0x0011080300308084, []Bitboard{}},
	{SquareA8, 7, 0x0000440085272000, []Bitboard{}},
	{SquareB8, 7, 0x02b0010012018200, []Bitboard{}},
	{SquareC8, 7, 0x0200000080802114, []Bitboard{}},
	{SquareD8, 7, 0x0011080300308084, []Bitboard{}},
	{SquareE8, 7, 0x0002090404008205, []Bitboard{}},
	{SquareF8, 7, 0x0020081001101121, []Bitboard{}},
	{SquareG8, 7, 0x0200090d00884010, []Bitboard{}},
	{SquareH8, 7, 0x00400a4182001490, []Bitboard{}},
}
View Source
var BISHOP_VALUE = Accum{300, 320}
View Source
var BishopAttack [BOARD_AREA]Bitboard
View Source
var CENTER_PAWN_VALUE = Accum{150, 120}
View Source
var ColorFigure [2][18]Piece

ColorFigure constructs a Piece from Color and Figure

View Source
var ColorOf [36]Color

ColorOf tells the color of a Piece

View Source
var FigureOf [36]Figure
View Source
var FileLetterOf = [NUM_FILES]string{"a", "b", "c", "d", "e", "f", "g", "h"}

FileOf tells the file of a square

View Source
var JAILER_VALUE = Accum{400, 420}
View Source
var JailerAdjacent [BOARD_AREA]Bitboard
View Source
var KING_DELTAS = append(BISHOP_DELTAS, ROOK_DELTAS...)
View Source
var KNIGHT_CLOSE_TO_EDGE_DEDUCTION = Accum{25, 25}
View Source
var KNIGHT_DELTAS = []Delta{{1, 2}, {1, -2}, {-1, 2}, {-1, -2}, {2, 1}, {2, -1}, {-2, 1}, {-2, -1}}
View Source
var KNIGHT_ON_EDGE_DEDUCTION = Accum{50, 50}
View Source
var KNIGHT_VALUE = Accum{300, 300}
View Source
var KingAttack [BOARD_AREA]Bitboard
View Source
var KnightAttack [BOARD_AREA]Bitboard
View Source
var LANCER_DELTAS = []Delta{{1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}, {-1, -1}, {0, -1}, {1, -1}}
View Source
var LANCER_FACING_OUT_VALUE = Accum{0, 0}
View Source
var LANCER_HOME_BONUS = Accum{200, 0}
View Source
var LANCER_VALUE = Accum{700, 720}
View Source
var PAWN_VALUE = Accum{100, 120}
View Source
var PawnDir = []Rank{-1, 1}
View Source
var PawnStartRank = []Rank{6, 1}
View Source
var PieceMaterialTables [PieceArraySize + 2]PieceMaterialTable
View Source
var PromotionRank = []Rank{0, 7}
View Source
var QUEEN_VALUE = Accum{900, 920}
View Source
var QueenAttack [BOARD_AREA]Bitboard
View Source
var ROOK_DELTAS = []Delta{{1, 0}, {-1, 0}, {0, 1}, {0, -1}}
View Source
var ROOK_MAGICS = Magics{
	{SquareA1, 14, 0x0004220080104000, []Bitboard{}},
	{SquareB1, 14, 0x0018004240681000, []Bitboard{}},
	{SquareC1, 14, 0x0030000205102000, []Bitboard{}},
	{SquareD1, 14, 0x0200020110208a00, []Bitboard{}},
	{SquareE1, 13, 0x0200080401008200, []Bitboard{}},
	{SquareF1, 13, 0x0200080401008200, []Bitboard{}},
	{SquareG1, 13, 0x0200042060510200, []Bitboard{}},
	{SquareH1, 14, 0x0010005080281100, []Bitboard{}},
	{SquareA2, 13, 0x0000f00021081400, []Bitboard{}},
	{SquareB2, 13, 0x0000020408401000, []Bitboard{}},
	{SquareC2, 13, 0x0000900220009000, []Bitboard{}},
	{SquareD2, 13, 0x0000400140041200, []Bitboard{}},
	{SquareE2, 14, 0x0000080100480340, []Bitboard{}},
	{SquareF2, 14, 0x0000040100402210, []Bitboard{}},
	{SquareG2, 12, 0x0054000080420328, []Bitboard{}},
	{SquareH2, 14, 0x00840800900200c8, []Bitboard{}},
	{SquareA3, 13, 0x0000580600148000, []Bitboard{}},
	{SquareB3, 13, 0x0000810200085000, []Bitboard{}},
	{SquareC3, 13, 0x0000341002100080, []Bitboard{}},
	{SquareD3, 13, 0x0000011000104080, []Bitboard{}},
	{SquareE3, 13, 0x0000230001000098, []Bitboard{}},
	{SquareF3, 14, 0x0000010400002100, []Bitboard{}},
	{SquareG3, 14, 0x0001084011000080, []Bitboard{}},
	{SquareH3, 13, 0x0000081000400100, []Bitboard{}},
	{SquareA4, 13, 0x0001480804001000, []Bitboard{}},
	{SquareB4, 14, 0x0000040110000200, []Bitboard{}},
	{SquareC4, 13, 0x0000089061000200, []Bitboard{}},
	{SquareD4, 13, 0x0000100500024100, []Bitboard{}},
	{SquareE4, 14, 0x0000044200004a00, []Bitboard{}},
	{SquareF4, 13, 0x0000005200018108, []Bitboard{}},
	{SquareG4, 12, 0x0000009400004118, []Bitboard{}},
	{SquareH4, 13, 0x0000002030080280, []Bitboard{}},
	{SquareA5, 13, 0x0000081100288000, []Bitboard{}},
	{SquareB5, 14, 0x0000024200890880, []Bitboard{}},
	{SquareC5, 13, 0x0208841042000200, []Bitboard{}},
	{SquareD5, 14, 0x0090018802000120, []Bitboard{}},
	{SquareE5, 13, 0x0000230001000098, []Bitboard{}},
	{SquareF5, 13, 0x000002283000c020, []Bitboard{}},
	{SquareG5, 12, 0x0001004204000288, []Bitboard{}},
	{SquareH5, 13, 0x0200014002a40010, []Bitboard{}},
	{SquareA6, 12, 0x00009080c02a8000, []Bitboard{}},
	{SquareB6, 13, 0x0001080090080200, []Bitboard{}},
	{SquareC6, 13, 0x0000040e00a02000, []Bitboard{}},
	{SquareD6, 13, 0x00002c1201000400, []Bitboard{}},
	{SquareE6, 13, 0x00000218400a1800, []Bitboard{}},
	{SquareF6, 13, 0x0000040080010400, []Bitboard{}},
	{SquareG6, 13, 0x0000010120408004, []Bitboard{}},
	{SquareH6, 13, 0x0000004000220802, []Bitboard{}},
	{SquareA7, 12, 0x0000832600442a00, []Bitboard{}},
	{SquareB7, 13, 0x00004081041a1200, []Bitboard{}},
	{SquareC7, 13, 0x000c702008c00200, []Bitboard{}},
	{SquareD7, 12, 0x0000200851040200, []Bitboard{}},
	{SquareE7, 13, 0x0000100140880200, []Bitboard{}},
	{SquareF7, 12, 0x0200080401008200, []Bitboard{}},
	{SquareG7, 11, 0x0000020800815400, []Bitboard{}},
	{SquareH7, 13, 0x0000001842400320, []Bitboard{}},
	{SquareA8, 13, 0x0000c060218a0012, []Bitboard{}},
	{SquareB8, 13, 0x0002000480406152, []Bitboard{}},
	{SquareC8, 13, 0x00000402080940a2, []Bitboard{}},
	{SquareD8, 13, 0x0000020201181022, []Bitboard{}},
	{SquareE8, 14, 0x0008012050008402, []Bitboard{}},
	{SquareF8, 14, 0x00000081120000aa, []Bitboard{}},
	{SquareG8, 12, 0x0000044201080084, []Bitboard{}},
	{SquareH8, 13, 0x0000008031004022, []Bitboard{}},
}
View Source
var ROOK_VALUE = Accum{500, 520}
View Source
var Rand = rand.New(rand.NewSource(1))

RankFile constructs a square from rank and file

View Source
var RankLetterOf = [NUM_RANKS]string{"1", "2", "3", "4", "5", "6", "7", "8"}

RankOf tells the rank of a square

View Source
var RookAttack [BOARD_AREA]Bitboard
View Source
var SEMI_CENTER_PAWN_VALUE = Accum{125, 120}
View Source
var SENTRY_VALUE = Accum{320, 320}
View Source
var SymbolOf = [18]string{
	".",
	"p",
	"n",
	"b",
	"r",
	"q",
	"k",
	"l",
	"ln",
	"lne",
	"le",
	"lse",
	"ls",
	"lsw",
	"lw",
	"lnw",
	"s",
	"j",
}

SymbolOf tells the symbol of a Figure

View Source
var SymbolToPiece = map[string]Piece{
	"p":   BlackPawn,
	"P":   WhitePawn,
	"n":   BlackKnight,
	"N":   WhiteKnight,
	"b":   BlackBishop,
	"B":   WhiteBishop,
	"r":   BlackRook,
	"R":   WhiteRook,
	"q":   BlackQueen,
	"Q":   WhiteQueen,
	"k":   BlackKing,
	"K":   WhiteKing,
	"l":   BlackLancer,
	"L":   WhiteLancer,
	"ln":  BlackLancerN,
	"Ln":  WhiteLancerN,
	"lne": BlackLancerNE,
	"Lne": WhiteLancerNE,
	"le":  BlackLancerE,
	"Le":  WhiteLancerE,
	"lse": BlackLancerSE,
	"Lse": WhiteLancerSE,
	"ls":  BlackLancerS,
	"Ls":  WhiteLancerS,
	"lsw": BlackLancerSW,
	"Lsw": WhiteLancerSW,
	"lw":  BlackLancerW,
	"Lw":  WhiteLancerW,
	"lnw": BlackLancerNW,
	"Lnw": WhiteLancerNW,
	"s":   BlackSentry,
	"S":   WhiteSentry,
	"j":   BlackJailer,
	"J":   WhiteJailer,
}

SymbolToPiece tells Piece for a FEN symbol

View Source
var TotalMagicEntries int = 0
View Source
var UCIToSquare map[string]Square
View Source
var VARIANT_NAMES = make([]string, len(VariantInfos))
View Source
var VariantInfos = []VariantInfo{
	{
		StartFen:    "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
		DisplayName: "Standard",
	},
	{
		StartFen:    "jlsesqkbnr/pppppppp/8/8/8/8/PPPPPPPP/JLneSQKBNR w KQkq - 0 1 -",
		DisplayName: "Eightpiece",
	},
	{
		StartFen:    "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
		DisplayName: "Atomic",
	},
}
View Source
var Wizards = []Wizard{
	{
		Name:   "bishop",
		Deltas: BISHOP_DELTAS,
		Tries:  50000,
		Magics: BISHOP_MAGICS,
	},
	{
		Name:   "rook",
		Deltas: ROOK_DELTAS,
		Tries:  50000,
		Magics: ROOK_MAGICS,
	},
}

Functions

func About

func About() string

func FmtDummy

func FmtDummy()

func GenAttackSquares

func GenAttackSquares(sq Square, normFunc func(Square, Square) (Delta, bool)) ([]Square, Bitboard)

func PieceMaterialTablesString

func PieceMaterialTablesString() string

func SearchMagic

func SearchMagic(sq Square, sqs []Square, deltas []Delta, tries int) (int, uint64, bool, int)

func SlidingAttack

func SlidingAttack(sq Square, deltas []Delta, occup Bitboard) (Bitboard, []Square)

func Uint32ToByteSlice

func Uint32ToByteSlice(v uint32) []byte

Types

type Accum

type Accum struct {
	M Score
	E Score
}

func GetMaterialForPieceAtSquare

func GetMaterialForPieceAtSquare(p Piece, sq Square) Accum

func (*Accum) Merge

func (acc *Accum) Merge(otherAcc Accum)

func (Accum) Mult

func (acc Accum) Mult(s Score) Accum

func (Accum) String

func (acc Accum) String() string

func (Accum) Sub

func (acc Accum) Sub(otherAcc Accum) Accum

func (*Accum) UnMerge

func (acc *Accum) UnMerge(otherAcc Accum)

type AlphaBetaInfo

type AlphaBetaInfo struct {
	Alpha         Score
	Beta          Score
	CurrentDepth  int
	MaxDepth      int
	NullMoveMade  bool
	NullMoveDepth int
}

type Bitboard

type Bitboard uint64

Bitboard is a set representing the 8x8 chess board squares

const (
	BbEmpty              Bitboard = 0x0000000000000000
	BbFull               Bitboard = 0xffffffffffffffff
	BbBorder             Bitboard = 0xff818181818181ff
	BbPawnStartRank      Bitboard = 0x00ff00000000ff00
	BbPawnStartRankBlack Bitboard = 0x00ff000000000000
	BbPawnStartRankWhite Bitboard = 0x000000000000ff00
	BbPawnDoubleRank     Bitboard = 0x000000ffff000000
	BbBlackSquares       Bitboard = 0xaa55aa55aa55aa55
	BbWhiteSquares       Bitboard = 0x55aa55aa55aa55aa
)

useful bitboards

const (
	BbFileA Bitboard = 0x101010101010101 << iota
	BbFileB
	BbFileC
	BbFileD
	BbFileE
	BbFileF
	BbFileG
	BbFileH
)
const (
	BbRank1 Bitboard = 0x0000000000000FF << (8 * iota)
	BbRank2
	BbRank3
	BbRank4
	BbRank5
	BbRank6
	BbRank7
	BbRank8
)

func BackwardFill

func BackwardFill(col Color, bb Bitboard) Bitboard

BackwardFill computes forward fill wrt color

func BackwardSpan

func BackwardSpan(col Color, bb Bitboard) Bitboard

BackwardSpan computes backward span wrt color

func BishopMobility

func BishopMobility(kind MoveKind, sq Square, occupUs, occupThem Bitboard) Bitboard

func East

func East(bb Bitboard) Bitboard

East shifts all squares one file right delete h-file, then shift left

func FileBb

func FileBb(file int) Bitboard

FileBb returns a bitboard with all bits on file set

func Fill

func Fill(bb Bitboard) Bitboard

Fill returns a bitboard with all files with squares filled.

func ForwardFill

func ForwardFill(col Color, bb Bitboard) Bitboard

ForwardFill computes forward fill wrt color.

func ForwardSpan

func ForwardSpan(col Color, bb Bitboard) Bitboard

ForwardSpan computes forward span wrt color.

func JumpAttack

func JumpAttack(sq Square, deltas []Delta) Bitboard

func KingMobility

func KingMobility(kind MoveKind, sq Square, occupUs, occupThem Bitboard) Bitboard

func KnightMobility

func KnightMobility(kind MoveKind, sq Square, occupUs, occupThem Bitboard) Bitboard

func LancerMobility

func LancerMobility(kind MoveKind, ld int, sq Square, occupUs, occupThem Bitboard) Bitboard

func North

func North(bb Bitboard) Bitboard

North shifts all squares one rank up

func NorthFill

func NorthFill(bb Bitboard) Bitboard

NorthFill returns a bitboard with all north bits set

func NorthSpan

func NorthSpan(bb Bitboard) Bitboard

NorthSpan is like NorthFill shifted on up

func QueenMobility

func QueenMobility(kind MoveKind, sq Square, occupUs, occupThem Bitboard) Bitboard

func RankBb

func RankBb(rank int) Bitboard

RankBb returns a bitboard with all bits on rank set

func RookMobility

func RookMobility(kind MoveKind, sq Square, occupUs, occupThem Bitboard) Bitboard

func South

func South(bb Bitboard) Bitboard

South shifts all squares one rank down

func SouthFill

func SouthFill(bb Bitboard) Bitboard

SouthFill returns a bitboard with all south bits set

func SouthSpan

func SouthSpan(bb Bitboard) Bitboard

SouthSpan is like SouthFill shifted on up

func Translate

func Translate(sqs []Square, occup uint64) Bitboard

func West

func West(bb Bitboard) Bitboard

West shifts all squares one file left delete a-file, then shift right

func (Bitboard) AsSquare

func (bb Bitboard) AsSquare() Square

AsSquare returns the occupied square if the bitboard has a single piece if the board has more then one piece the result is undefined https://golang.org/pkg/math/bits/#TrailingZeros64

func (Bitboard) Count

func (bb Bitboard) Count() int32

count returns the number of squares set in bb https://golang.org/pkg/math/bits/#OnesCount64

func (Bitboard) Has

func (bb Bitboard) Has(sq Square) bool

Has returns bb if sq is occupied in bitboard

func (Bitboard) LSB

func (bb Bitboard) LSB() Bitboard

LSB picks a square in the board returns empty board for empty board

func (*Bitboard) Pop

func (bb *Bitboard) Pop() Square

Pop pops a set square from the bitboard

func (*Bitboard) PopAll

func (bb *Bitboard) PopAll() []Square

PopAll pops all set squares from the bitboard

func (Bitboard) String

func (bb Bitboard) String() string

String return the string representation of a bitboard

type CastlingRight

type CastlingRight struct {
	CanCastle          bool
	RookOrigSq         Square
	RookOrigPiece      Piece
	BetweenOrigSquares []Square
}

type CastlingRights

type CastlingRights [2]ColorCastlingRights

func (CastlingRights) String

func (crs CastlingRights) String() string

CastlingRights.String() reports castling rights in fen format

type Color

type Color int

func (Color) Inverse

func (color Color) Inverse() Color

func (Color) String

func (color Color) String() string

Color.String() converts a color to "b" for black, "w" for white and "-" for no color

type ColorCastlingRights

type ColorCastlingRights [2]CastlingRight

func (ColorCastlingRights) CanCastle

func (ccr ColorCastlingRights) CanCastle() bool

type ColorPawnInfo

type ColorPawnInfo [2]PawnInfo

type Delta

type Delta struct {
	// contains filtered or unexported fields
}

Delta is a square vector

func NormalizedBishopDirection

func NormalizedBishopDirection(fromSq, toSq Square) (Delta, bool)

NormalizedBishopDirection tells the normalized bishop direction from fromSq to toSq returns true in the second return parameter if such a direction exists, false otherwise

func NormalizedRookDirection

func NormalizedRookDirection(fromSq, toSq Square) (Delta, bool)

NormalizedRookDirection tells the normalized rook direction from fromSq to toSq returns true in the second return parameter if such a direction exists, false otherwise

type Figure

type Figure int

type File

type File int

type KingInfo

type KingInfo struct {
	IsCaptured bool
	Square     Square
}

type MagicSquare

type MagicSquare struct {
	Square  Square
	Shift   int
	Magic   uint64
	Entries []Bitboard
}

func (MagicSquare) Key

func (msq MagicSquare) Key(occup Bitboard) uint64

func (MagicSquare) String

func (msq MagicSquare) String() string

type Magics

type Magics [BOARD_AREA]MagicSquare

func (*Magics) Attack

func (ms *Magics) Attack(sq Square, occup Bitboard) Bitboard

type Move

type Move uint32

func MakeMoveFT

func MakeMoveFT(fromSq, toSq Square) Move

func MakeMoveFTC

func MakeMoveFTC(fromSq, toSq Square) Move

func MakeMoveFTP

func MakeMoveFTP(fromSq, toSq Square, pp Piece) Move

func MakeMoveFTPS

func MakeMoveFTPS(fromSq, toSq Square, pp Piece, ps Square) Move

func (Move) FromSq

func (move Move) FromSq() Square

func (Move) MoveType

func (move Move) MoveType() MoveType

func (Move) PromotionPiece

func (move Move) PromotionPiece() Piece

func (Move) PromotionSquare

func (move Move) PromotionSquare() Square

func (Move) String

func (move Move) String() string

func (Move) ToSq

func (move Move) ToSq() Square

func (Move) UCI

func (move Move) UCI() string

type MoveBuff

type MoveBuff []MoveBuffItem

func (MoveBuff) Len

func (mb MoveBuff) Len() int

func (MoveBuff) Less

func (mb MoveBuff) Less(i, j int) bool

func (MoveBuff) PrettyPrintString

func (mb MoveBuff) PrettyPrintString() string

func (MoveBuff) Swap

func (mb MoveBuff) Swap(i, j int)

type MoveBuffItem

type MoveBuffItem struct {
	Move Move
	Uci  string
	Lan  string
	San  string
}

type MoveKind

type MoveKind int

func (MoveKind) IsQuiet

func (mk MoveKind) IsQuiet() bool

func (MoveKind) IsViolent

func (mk MoveKind) IsViolent() bool

type MoveType

type MoveType uint8

func (MoveType) String

func (mt MoveType) String() string

type MultiPvInfo

type MultiPvInfo struct {
	Index int
	Depth int
	Time  int
	Nodes int
	Nps   float32
	Score Score
	Pv    []Move
	PvUCI string
}

func (MultiPvInfo) String

func (mpi MultiPvInfo) String() string

type MultiPvInfos

type MultiPvInfos [MAX_MULTIPV]MultiPvInfo

type PawnInfo

type PawnInfo struct {
	Dir       Rank
	Pushes    []PawnInfoItem
	Captures  []PawnInfoItem
	PushOneSq Square
	CheckEps  []Square
}

type PawnInfoItem

type PawnInfoItem struct {
	CheckSq Square
	Move    Move
}

type Piece

type Piece int

func MakeLancer

func MakeLancer(color Color, ld int) Piece

func (Piece) Color

func (p Piece) Color() Color

Color tells the color of a Piece

func (Piece) ColorInverse

func (p Piece) ColorInverse() Piece

ColorInverse tells the color inverse of a piece

func (Piece) FenSymbol

func (p Piece) FenSymbol() string

FenSymbol tells the FEN symbol of a Piece

func (Piece) Figure

func (p Piece) Figure() Figure

Figure tells the Figure of a Piece

func (Piece) IsLancer

func (p Piece) IsLancer() bool

IsLancer tells whether a Piece is a lancer

func (Piece) LancerDirection

func (l Piece) LancerDirection() int

func (Piece) PrettySymbol

func (p Piece) PrettySymbol() string

PrettySymbol tells the pretty print symbol of a Piece

func (Piece) SanLetter

func (p Piece) SanLetter() string

SanLetter tells the SAN letter of a Piece

func (Piece) SanSymbol

func (p Piece) SanSymbol() string

SanSymbol tells the SAN symbol of a Piece ( letter always upper case )

func (Piece) String

func (p Piece) String() string

String tells the string representation of a Piece, default to UCI

func (Piece) UCI

func (p Piece) UCI() string

UCI tells the UCI symbol of a Piece ( letter always lower case )

type PieceMaterialTable

type PieceMaterialTable [BOARD_AREA]Accum

func (*PieceMaterialTable) Fill

func (mt *PieceMaterialTable) Fill(accum Accum)

func (PieceMaterialTable) POV

POV returns material table from point of view of color

func (PieceMaterialTable) String

func (pmt PieceMaterialTable) String() string

type PosMoveEntry

type PosMoveEntry struct {
	Used    bool
	Depth   int8
	SubTree int
}

type PosMoveHash

type PosMoveHash struct {
	Entries [POS_MOVE_HASH_SIZE]PosMoveEntry
}
var PosMoveTable PosMoveHash

func (*PosMoveHash) Get

func (pmh *PosMoveHash) Get(zobrist uint64, move Move) (uint32, PosMoveEntry)

func (*PosMoveHash) Set

func (pmh *PosMoveHash) Set(zobrist uint64, move Move, pme PosMoveEntry)

type Position

type Position struct {
	States                  [MAX_STATES]State
	StatePtr                int
	SearchRootPtr           int
	MaxStatePtr             int
	Nodes                   int
	SearchStopped           bool
	NullMovePruning         bool
	NullMovePruningMinDepth int
	NullMoveDepthReduction  int
	StackReduction          bool
	AspirationWindow        bool
	PvTable                 *PvHash
	PosMoveTable            *PosMoveHash
	LastRootPvScore         Score
	LastGoodPv              []Move
	Start                   time.Time
	CheckPoint              time.Time
	Depth                   int
	Verbose                 bool
	IgnoreRootMoves         []Move
	PruningAgressivity      int
	PruningReduction        int
	MultiPV                 int
	MultiPvInfos            MultiPvInfos
	OldMultiPvInfos         MultiPvInfos
	MultiPvIndex            int
	LogFilePath             string
}

func (*Position) AlphaBeta

func (pos *Position) AlphaBeta(maxDepth int) Score

func (*Position) AlphaBetaRec

func (pos *Position) AlphaBetaRec(abi AlphaBetaInfo) Score

func (Position) CheckTime

func (pos Position) CheckTime() float32

func (*Position) ClearPosMoveTable

func (pos *Position) ClearPosMoveTable()

func (*Position) ClearPvTable

func (pos *Position) ClearPvTable()

func (*Position) Current

func (pos *Position) Current() *State

func (*Position) ExecCommand

func (pos *Position) ExecCommand(command string)

func (Position) GameEnd

func (pos Position) GameEnd(ply int) (bool, Score)

func (Position) GetPv

func (pos Position) GetPv(maxDepth int) []Move

func (Position) GetPvRec

func (pos Position) GetPvRec(depthRemaining int, pvSoFar []Move) []Move

func (*Position) Init

func (pos *Position) Init(variant Variant)

func (Position) IsMateInN

func (pos Position) IsMateInN() bool

func (Position) Line

func (pos Position) Line() string

func (Position) Log

func (pos Position) Log(content string)

func (Position) Nps

func (pos Position) Nps() float32

func (*Position) ParseFen

func (pos *Position) ParseFen(fen string)

func (*Position) Perf

func (pos *Position) Perf(depth int)

func (*Position) PerfRec

func (pos *Position) PerfRec(remDepth int)

func (*Position) Pop

func (pos *Position) Pop()

func (Position) PrettyPrintString

func (pos Position) PrettyPrintString() string

func (*Position) Print

func (pos *Position) Print()

func (*Position) PrintBestMove

func (pos *Position) PrintBestMove(pv []Move)

func (*Position) Push

func (pos *Position) Push(move Move)

func (*Position) PushUci

func (pos *Position) PushUci(uci string)

func (Position) PvUCI

func (pos Position) PvUCI() string

func (*Position) Reset

func (pos *Position) Reset()

func (*Position) Search

func (pos *Position) Search(maxDepth int)

func (Position) SearchRoot

func (pos Position) SearchRoot() *State

func (Position) Time

func (pos Position) Time() float32

func (Position) TimeMs

func (pos Position) TimeMs() int

func (Position) Zobrist

func (pos Position) Zobrist() uint64

type PvEntry

type PvEntry struct {
	Depth   int8
	Zobrist uint64
	Moves   [MAX_PV_MOVES]Move
}

type PvHash

type PvHash struct {
	Entries [PV_HASH_SIZE]PvEntry
}
var PvTable PvHash

func (*PvHash) Get

func (pvh *PvHash) Get(zobrist uint64) (uint32, PvEntry, bool)

func (*PvHash) Set

func (pvh *PvHash) Set(zobrist uint64, pve PvEntry)

type Rank

type Rank int

type Score

type Score int16

func (Score) IsMateInN

func (sc Score) IsMateInN() bool

type Square

type Square uint

func (Square) Bitboard

func (sq Square) Bitboard() Bitboard

Bitboard returns a bitboard that has sq set

func (Square) File

func (sq Square) File() File

File tells the file of a square

func (Square) Rank

func (sq Square) Rank() Rank

Rank tells the rank of a square

func (Square) String

func (sq Square) String() string

String tells the string representation of a square, defaults to UCI

func (Square) UCI

func (sq Square) UCI() string

UCI tells the UCI representation of a square

type StackBuff

type StackBuff []StackBuffEntry

func (StackBuff) Len

func (sb StackBuff) Len() int

func (StackBuff) Less

func (sb StackBuff) Less(i, j int) bool

func (StackBuff) Swap

func (sb StackBuff) Swap(i, j int)

type StackBuffEntry

type StackBuffEntry struct {
	Move      Move
	IsPv      bool
	PvIndex   int
	IsCapture bool
	Mobility  Accum
	SubTree   int
}

type State

type State struct {
	Variant              Variant
	Pieces               [NUM_RANKS][NUM_FILES]Piece
	Turn                 Color
	CastlingRights       CastlingRights
	EpSquare             Square
	HalfmoveClock        int
	FullmoveNumber       int
	HasDisabledMove      bool
	DisableFromSquare    Square
	DisableToSquare      Square
	ByFigure             [FigureArraySize]Bitboard
	ByLancer             Bitboard
	ByColor              [ColorArraySize]Bitboard
	Ply                  int
	Move                 Move
	MoveBuff             MoveBuff
	Material             [ColorArraySize]Accum
	Zobrist              uint64
	KingInfos            [ColorArraySize]KingInfo
	StackPhase           int
	StackBuff            StackBuff
	StackPvMoves         [MAX_PV_MOVES]Move
	StackReduceFrom      int
	StackReduceDepth     int
	StackReduceFactor    int
	LostCastlingForColor [ColorArraySize]bool
	StackIgnoreMoves     []Move
}

State records the state of a position

func (State) AddDeltaToSquare

func (st State) AddDeltaToSquare(sq Square, delta Delta) (Square, bool)

func (State) AppendMove

func (st State) AppendMove(moves *[]Move, move Move, jailColor Color)

func (*State) CalculateOccupancyAndMaterial

func (st *State) CalculateOccupancyAndMaterial()

func (State) CastlingRank

func (st State) CastlingRank(color Color) Rank

func (State) CastlingTargetSquares

func (st State) CastlingTargetSquares(color Color, side int) [2]Square

func (State) GenBitboardMoves

func (st State) GenBitboardMoves(sq Square, mobility Bitboard, jailColor Color) []Move

func (State) GenLancerMoves

func (st State) GenLancerMoves(color Color, sq Square, mobility Bitboard, keepDir bool, lancerDir int, jailColor Color) []Move

func (*State) GenMoveBuff

func (st *State) GenMoveBuff()

func (State) GenPawnMoves

func (st State) GenPawnMoves(kind MoveKind, color Color, sq Square, occupUs, occupThem Bitboard, jailColor Color, disablePushByTwo bool) []Move

func (State) GenSentryMoves

func (st State) GenSentryMoves(kind MoveKind, color Color, sq Square, occupUs, occupThem Bitboard, jailColor Color) []Move

func (State) GenerateMoves

func (st State) GenerateMoves() []Move

func (*State) GetZobrist

func (st *State) GetZobrist() uint64

Zobrist returns the zobrist key of the position, never returns 0

func (State) HasLegalMove

func (st State) HasLegalMove() bool

func (*State) Init

func (st *State) Init(variant Variant)

Init initializes state sets itself up from variant start fen

func (*State) InitStack

func (st *State) InitStack(nmp bool, pvTable *PvHash, ignoreMoves []Move)

func (State) IsCapture

func (st State) IsCapture(move Move) bool

func (State) IsCastlingPartner

func (st State) IsCastlingPartner(fig Figure) bool

func (State) IsChecked

func (st State) IsChecked(color Color) bool

func (State) IsCheckedSansExplosion

func (st State) IsCheckedSansExplosion(color Color) bool

func (State) IsCheckedThem

func (st State) IsCheckedThem() bool

func (State) IsCheckedUs

func (st State) IsCheckedUs() bool

func (State) IsSquareJailedForColor

func (st State) IsSquareJailedForColor(sq Square, color Color) bool

func (State) KingsAdjacent

func (st State) KingsAdjacent() bool

func (State) LegalMoves

func (st State) LegalMoves(stopAtFirst bool) []Move

func (State) LostCastlingDeductionBalance

func (st State) LostCastlingDeductionBalance(phase float32) Score

func (State) LostCastlingDeductionForColor

func (st State) LostCastlingDeductionForColor(color Color, phase float32) Score

func (State) LostCastlingDeductionPOV

func (st State) LostCastlingDeductionPOV(phase float32) Score

func (*State) MakeMove

func (st *State) MakeMove(move Move)

func (State) MaterialPOV

func (st State) MaterialPOV() Accum

func (State) MobilityBalance

func (st State) MobilityBalance() Accum

func (State) MobilityForColor

func (st State) MobilityForColor(color Color) Accum

func (State) MobilityForPieceAtSquare

func (st State) MobilityForPieceAtSquare(p Piece, sq Square) Accum

func (State) MobilityPOV

func (st State) MobilityPOV() Accum

func (State) MoveLAN

func (st State) MoveLAN(move Move) string

func (*State) MoveToSan

func (st *State) MoveToSan(move Move) string

func (State) MoveToSanBatch

func (st State) MoveToSanBatch(move Move) string

func (State) OccupThem

func (st State) OccupThem() Bitboard

func (State) OccupUs

func (st State) OccupUs() Bitboard

func (*State) ParseCastlingRights

func (st *State) ParseCastlingRights(crs string)

func (*State) ParseDisabledMove

func (st *State) ParseDisabledMove(dms string)

func (*State) ParseEpSquare

func (st *State) ParseEpSquare(epsqs string)

func (*State) ParseFen

func (st *State) ParseFen(fen string) error

ParseFen sets up state from a fen

func (*State) ParseFullmoveNumber

func (st *State) ParseFullmoveNumber(fmns string)

func (*State) ParseHalfmoveClock

func (st *State) ParseHalfmoveClock(hmcs string)

func (*State) ParsePlacementString

func (st *State) ParsePlacementString(ps string) error

ParsePlacementString parses a placement string and sets pieces accordingly returns an error if there are not enough pieces to fill the board liberal otherwise

func (*State) ParseTurnString

func (st *State) ParseTurnString(ts string)

func (State) Phase

func (st State) Phase() float32

func (State) PieceAtSquare

func (st State) PieceAtSquare(sq Square) Piece

func (*State) PopStack

func (st *State) PopStack(pos *Position) Move

func (*State) PopStackBuff

func (st *State) PopStackBuff() (StackBuffEntry, bool)

func (*State) PopulateCastlingRights

func (st *State) PopulateCastlingRights(crs CastlingRights) CastlingRights

PopulateCastlingRights determines castling rights information based on piece placement also does sanity check

func (State) PrettyPlacementString

func (st State) PrettyPlacementString() string

PrettyPlacementString returns the pretty string representation of the board

func (State) PrettyPrintString

func (st State) PrettyPrintString() string

PrettyPrintString returns the state pretty print string

func (State) PromotionFigures

func (st State) PromotionFigures() []Figure

func (State) Pslms

func (st State) Pslms(kind MoveKind) []Move

func (State) PslmsForColor

func (st State) PslmsForColor(kind MoveKind, color Color) []Move

func (State) PslmsForPieceAtSquare

func (st State) PslmsForPieceAtSquare(kind MoveKind, p Piece, sq Square, occupUs, occupThem Bitboard, jailColor Color) []Move

func (*State) Put

func (st *State) Put(p Piece, sq Square)

func (*State) Remove

func (st *State) Remove(sq Square)

func (State) ReportFen

func (st State) ReportFen() string

ReportFen reports the state as a fen string

func (*State) Reset

func (st *State) Reset()

Reset resets the starting position

func (State) Score

func (st State) Score() Score

func (*State) SetCastlingAbility

func (st *State) SetCastlingAbility(newCastlingRighs CastlingRights)

SetCastlingAbility sets the side to move, correctly updating the Zobrist key

func (*State) SetEpSquare

func (st *State) SetEpSquare(epsq Square)

SetEnpassantSquare sets the en passant square correctly updating the Zobrist key

func (*State) SetSideToMove

func (st *State) SetSideToMove(color Color)

SetSideToMove sets the side to move, correctly updating the Zobrist key

func (*State) SetStackBuff

func (st *State) SetStackBuff(pos *Position, moves []Move)

func (*State) UciToMove

func (st *State) UciToMove(uci string) (Move, bool)

func (*State) UpdateMaterialBalance

func (st *State) UpdateMaterialBalance()

type Tokenizer

type Tokenizer struct {
	Content string
}

func (*Tokenizer) GetCastlingRights

func (t *Tokenizer) GetCastlingRights() CastlingRights

func (*Tokenizer) GetColor

func (t *Tokenizer) GetColor() Color

func (*Tokenizer) GetFenPiece

func (t *Tokenizer) GetFenPiece() []Piece

func (*Tokenizer) GetInt

func (t *Tokenizer) GetInt() int

func (*Tokenizer) GetSquare

func (t *Tokenizer) GetSquare() Square

func (*Tokenizer) GetToken

func (t *Tokenizer) GetToken() (string, bool)

func (*Tokenizer) GetTokensUpTo

func (t *Tokenizer) GetTokensUpTo(upTo string) []string

func (*Tokenizer) Init

func (t *Tokenizer) Init(content string)

type TranspositionTableEntry

type TranspositionTableEntry struct {
	Score    Score
	RemDepth int
	Zobrist  uint64
}

type Variant

type Variant int

func VariantNameToVariant

func VariantNameToVariant(name string) Variant

func (Variant) String

func (v Variant) String() string

type VariantInfo

type VariantInfo struct {
	StartFen    string
	DisplayName string
}

type Wizard

type Wizard struct {
	Name   string
	Deltas []Delta
	Tries  int
	Magics Magics
}

func (*Wizard) GenAttacks

func (wiz *Wizard) GenAttacks()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL