Documentation
¶
Index ¶
- Constants
- Variables
- type SmallMove
- func (m *SmallMove) AddEstimatedValue(v int16)
- func (m *SmallMove) CoordsAndVertical() (int, int, bool)
- func (m *SmallMove) EstimatedValue() int16
- func (m *SmallMove) IsPass() bool
- func (m *SmallMove) PlayLength() int
- func (m *SmallMove) Score() int
- func (m *SmallMove) SetEstimatedValue(v int16)
- func (m *SmallMove) ShortDescription() string
- func (m *SmallMove) TilesPlayed() int
- func (m *SmallMove) TinyMove() TinyMove
- type SmallMoveArena
- type TinyMove
Constants ¶
const BlanksBitMask = 127 << 12
const ColBitMask = 0b00111110
const DefaultSmallMoveArenaSize = 65536
DefaultSmallMoveArenaSize is the initial capacity (in SmallMoves) for a SmallMoveArena. 65536 * 16 bytes = 1 MB, matching magpie's DEFAULT_INITIAL_SMALL_MOVE_ARENA_SIZE.
const RowBitMask = 0b00000111_11000000
Variables ¶
var DefaultSmallMove = SmallMove{}
DefaultSmallMove is a blank move (a pass)
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 SmallMove ¶
type SmallMove struct {
// contains filtered or unexported fields
}
A SmallMove consists of a TinyMove which encodes all the positional and tile info, plus a few extra fields needed for endgames and related modules. We're trying to strike a balance between decreasing allocations and still staying speedy.
func TilePlayMove ¶
func (*SmallMove) AddEstimatedValue ¶
AddEstimatedValue adds an estimate to the existing estimated value of this estimate. Estimate.
func (*SmallMove) EstimatedValue ¶
EstimatedValue is an internal value that is used in calculating endgames and related metrics.
func (*SmallMove) PlayLength ¶
func (*SmallMove) SetEstimatedValue ¶
SetEstimatedValue sets the estimated value of this move. It is calculated outside of this package.
func (*SmallMove) ShortDescription ¶
func (*SmallMove) TilesPlayed ¶
type SmallMoveArena ¶ added in v0.13.0
type SmallMoveArena struct {
// contains filtered or unexported fields
}
SmallMoveArena is a bump allocator for SmallMove slices. It uses LIFO (stack) discipline: Alloc advances the offset, Dealloc shrinks it. The backing slice grows as needed and is never freed — the GC handles it.
Each thread in the endgame/pre-endgame solver gets its own arena, so no synchronization is needed.
func NewSmallMoveArena ¶ added in v0.13.0
func NewSmallMoveArena(initialCap int) *SmallMoveArena
NewSmallMoveArena returns an arena with the given initial capacity.
func (*SmallMoveArena) Alloc ¶ added in v0.13.0
func (a *SmallMoveArena) Alloc(n int) []SmallMove
Alloc returns a sub-slice of length n from the arena, bumping the offset. The returned slice shares the arena's backing array. If there is insufficient capacity the backing slice is doubled (or grown to fit), which is expected to be rare given the generous initial size.
func (*SmallMoveArena) Dealloc ¶ added in v0.13.0
func (a *SmallMoveArena) Dealloc(n int)
Dealloc releases n elements from the top of the arena (LIFO).
func (*SmallMoveArena) Reset ¶ added in v0.13.0
func (a *SmallMoveArena) Reset()
Reset resets the arena to empty, logically freeing all allocations.