negamax

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TTExact = 0x01
	TTLower = 0x02
	TTUpper = 0x03
)
View Source
const BlanksBitMask = 127 << 12
View Source
const ColBitMask = 0b00111110
View Source
const EarlyPassOffset = 21000
View Source
const HashMoveOffset = 6000
View Source
const HugeNumber = int16(32767)
View Source
const Killer0Offset = 20000
View Source
const Killer1Offset = 19000
View Source
const MaxKillers = 2
View Source
const MaxLazySMPThreads = 6
View Source
const MaxVariantLength = 25
View Source
const RowBitMask = 0b00000111_11000000

Variables

View Source
var (
	ErrNoEndgameSolution = errors.New("no endgame solution found")
)
View Source
var TBitMasks = [7]uint64{63 << 20, 63 << 26, 63 << 32, 63 << 38, 63 << 44, 63 << 50, 63 << 56}

Functions

This section is empty.

Types

type DebugTableEntry

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

type DebugTranspositionTable

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

type FakeLock

type FakeLock struct{}

func (FakeLock) Lock

func (f FakeLock) Lock()

func (FakeLock) RLock

func (f FakeLock) RLock()

func (FakeLock) RUnlock

func (f FakeLock) RUnlock()

func (FakeLock) Unlock

func (f FakeLock) Unlock()

type PVLine

type PVLine struct {
	Moves []*move.Move
	// contains filtered or unexported fields
}

Credit: MIT-licensed https://github.com/algerbrex/blunder/blob/main/engine/search.go

func (*PVLine) Clear

func (pvLine *PVLine) Clear()

Clear the principal variation line.

func (*PVLine) GetPVMove

func (pvLine *PVLine) GetPVMove() *move.Move

Get the best move from the principal variation line.

func (PVLine) NLBString

func (pvLine PVLine) NLBString() string

func (PVLine) String

func (pvLine PVLine) String() string

Convert the principal variation line to a string.

func (*PVLine) Update

func (pvLine *PVLine) Update(move *move.Move, newPVLine PVLine, score int16)

Update the principal variation line with a new best move, and a new line of best play after the best move.

type Solver

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

func (*Solver) ClearKillers

func (s *Solver) ClearKillers()

Clear the killer moves table.

func (*Solver) Game added in v0.8.0

func (s *Solver) Game() *game.Game

func (*Solver) Init

func (s *Solver) Init(m movegen.MoveGenerator, game *game.Game) error

Init initializes the solver

func (*Solver) QuickAndDirtySolve

func (s *Solver) QuickAndDirtySolve(ctx context.Context, plies, thread int) (int16, []*move.Move, error)

QuickAndDirtySolve is meant for a pre-endgame engine to call this function without having to initialize everything. The caller is responsible for initializations of data structures. It is single-threaded as well.

func (*Solver) SetFirstWinOptim

func (s *Solver) SetFirstWinOptim(w bool)

func (*Solver) SetIterativeDeepening

func (s *Solver) SetIterativeDeepening(id bool)

func (*Solver) SetKillerPlayOptim

func (s *Solver) SetKillerPlayOptim(k bool)

func (*Solver) SetThreads

func (s *Solver) SetThreads(threads int)

func (*Solver) SetTranspositionTable

func (s *Solver) SetTranspositionTable(tt *TranspositionTable)

func (*Solver) SetTranspositionTableOptim

func (s *Solver) SetTranspositionTableOptim(tt bool)

func (*Solver) SetZobrist

func (s *Solver) SetZobrist(z *zobrist.Zobrist)

func (*Solver) Solve

func (s *Solver) Solve(ctx context.Context, plies int) (int16, []*move.Move, error)

type TableEntry

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

16 bytes (entrySize)

type TableLock

type TableLock interface {
	Lock()
	Unlock()
	RLock()
	RUnlock()
}

type TinyMove added in v0.7.1

type TinyMove uint64

TinyMove is a 64-bit representation of a move. We can probably make it smaller at the cost of higher decoding. It is made to be as small as possible to fit it in a transposition table.

type TranspositionTable

type TranspositionTable struct {
	TableLock
	// contains filtered or unexported fields
}

func (*TranspositionTable) Reset

func (t *TranspositionTable) Reset(fractionOfMemory float64)

func (*TranspositionTable) SetMultiThreadedMode

func (t *TranspositionTable) SetMultiThreadedMode()

func (*TranspositionTable) SetSingleThreadedMode

func (t *TranspositionTable) SetSingleThreadedMode()

Jump to

Keyboard shortcuts

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