Documentation
¶
Index ¶
- Constants
- Variables
- func MovesEqual(a [4][2]int8, b [4][2]int8) bool
- func PseudoPips(player int8, space int8, variant int8) int
- type Analysis
- type BEIServer
- type Board
- func (b Board) Analyze(available [][4][2]int8, result *[]*Analysis, skipOpponent bool) (analyzedPositions int)
- func (b Board) Available(player int8) ([][4][2]int8, []Board)
- func (b Board) Blots(player int8) int
- func (b Board) ChooseDoubles(result *[]*Analysis) int
- func (b Board) Evaluation(player int8, hitScore int, moves [4][2]int8) *Analysis
- func (b Board) FirstLast(player int8) (playerFirst int8, opponentLast int8)
- func (b Board) HaveRoll(from int8, to int8, player int8) bool
- func (b Board) MayBearOff(player int8) bool
- func (b Board) Move(from int8, to int8, player int8) Board
- func (b Board) Past() bool
- func (b Board) Pips(player int8) int
- func (b Board) Print()
- func (b Board) SecondHalf(player int8) bool
- func (b Board) SetValue(space int, value int8) Board
- func (b Board) StartingPosition(player int8) bool
- func (b Board) String() string
- func (b Board) UseRoll(from int8, to int8, player int8) Board
Constants ¶
const ( SpaceHomePlayer int8 = 0 SpaceHomeOpponent int8 = 25 SpaceBarPlayer int8 = 26 SpaceBarOpponent int8 = 27 SpaceRoll1 int8 = 28 SpaceRoll2 int8 = 29 SpaceRoll3 int8 = 30 SpaceRoll4 int8 = 31 SpaceEnteredPlayer int8 = 32 // Whether the player has fully entered the board. Only used in acey-deucey games. SpaceEnteredOpponent int8 = 33 // Whether the opponent has fully entered the board. Only used in acey-deucey games. SpaceVariant int8 = 34 // 0 - Backgammon, 1 - Acey-deucey, 2 - Tabula. SpaceCrawford int8 = 35 // 0 - Pending, 1 - Active, 2 - Expired. )
Named board "spaces".
const ( VariantBackgammon int8 = 0 VariantAceyDeucey int8 = 1 VariantTabula int8 = 2 )
Variants.
const ( CrawfordPending int8 = 0 CrawfordActive int8 = 1 CrawfordExpired int8 = 2 )
Crawford Rule.
Variables ¶
var ( WeightBlot = 0.9 WeightHit = -1.0 WeightOppScore = -0.9 )
var ( // AnalysisBufferSize is the size of the outer queue buffer, which handles analyzing boards provided to Tabula. AnalysisBufferSize = 128 // SubAnalysisBufferSize is the size of the inner queue buffer, which handles analyzing potential positions. SubAnalysisBufferSize = 3072 )
Buffer sizes.
var QueueBufferSize = 4096000
var Verbose bool
Functions ¶
func MovesEqual ¶
MovesEqual returns whether two sets of moves are logically equal.
Types ¶
type Analysis ¶
type BEIServer ¶
type BEIServer struct {
Verbose bool
}
func NewBEIServer ¶
func NewBEIServer() *BEIServer
func (*BEIServer) ListenLocal ¶
type Board ¶
type Board [boardSpaces]int8
Board represents the state of a game. It contains spaces for the checkers, as well as four "spaces" which contain the available die rolls.
func (Board) Analyze ¶
func (b Board) Analyze(available [][4][2]int8, result *[]*Analysis, skipOpponent bool) (analyzedPositions int)
Analyze analyzes all legal player moves and all legal opponent moves that may follow. The available moves and their potential counters are scored and sorted, and the final analysis is stored in the result slice.
func (Board) ChooseDoubles ¶
ChooseDoubles analyzes and returns the best choice of doubles in an acey-deucey game.
func (Board) Evaluation ¶
Evaluation scores a board and returns the resulting Analysis.
func (Board) FirstLast ¶
FirstLast returns the position of the specified player's first checker and their opponent's last checker.
func (Board) HaveRoll ¶
HaveRoll returns whether the player has a sufficient die roll for the specified move.
func (Board) MayBearOff ¶
MayBearOff returns whether the specified player is eligible to bear checkers off the board.
func (Board) Past ¶
Past returns whether the players have passed each other on the board with all of their checkers. When this is the case, hitting a checker is no longer possible.
func (Board) Pips ¶
Pips returns the total pip value corresponding to all of the checkers of the specified player.
func (Board) SecondHalf ¶
SecondHalf returns whether all of the checkers of the specified player are either located in the second half of the board or have been beared off.
func (Board) StartingPosition ¶
StartingPosition returns whether the specified player has all of their checkers in the initial position.