Package bei
    
  
	
	
		
		
		
		
		
		
		
			Constants
			
				
				const (
    CommandBEI    = "bei"
    CommandList   = "list"
    CommandSet    = "set"
    CommandDouble = "double"
    CommandMove   = "move"
    CommandChoose = "choose"
)
			
				
				const (
    StateHome1       = 0
    StateHome2       = 25
    StateBar1        = 26
    StateBar2        = 27
    StateRoll1       = 28
    StateRoll2       = 29
    StateRoll3       = 30
    StateTurn1       = 31
    StateTurn2       = 32
    StateCubeValue   = 33
    StateCubePlayer  = 34
    StatePoints1     = 35
    StatePoints2     = 36
    StateTotalPoints = 37
    StateCrawford    = 38
    StateJacoby      = 39
    StateMurphy      = 40
    StateBeavers     = 41
    StateVariant     = 42
    StateEntered1    = 43
    StateEntered2    = 44
)
			
				
				const (
    EventTypeOkBEI      = "okbei"
    EventTypeOkList     = "oklist"
    EventTypeFailSet    = "failset"
    EventTypeOkSet      = "okset"
    EventTypeFailDouble = "faildouble"
    EventTypeOkDouble   = "okdouble"
    EventTypeFailMove   = "failmove"
    EventTypeOkMove     = "okmove"
    EventTypeFailChoose = "failchoose"
    EventTypeOkChoose   = "okchoose"
)
			
				
				const CellCount = 45
			
		
		
		
			
			
			
			func DecodeEvent(message []byte) (interface{}, error)
			
			
			
		
			
			
			
			func EncodeEvent(e interface{}) ([]byte, error)
			
			
			
		
			
			
			
			func EncodeState(s *State) []int
			
			
			
		
		
			
			
			
			
			type BeaversType int
			
				
				const (
    BeaversNone BeaversType = iota
    BeaversOnly
    BeaversAndRaccoons
)
			
			
			
			
			
			
			
		
			
			
			
			
			type ChooseRoll struct {
    Roll          int
    Probabilities Probabilities
}
			
			
			
			
			
			
			
		
			
			
			
			
			type CubeEvaluation struct {
    Offer bool
    Take  bool
}
			
			
			
			
			
			
			
		
			
			
			
			
			type Event struct {
    Type string
}
			
			
			
			
			
			
			
		
			
			
			
			
			type EventFailChoose struct {
    Event
    Reason string
}
			
			
			
			
			
			
			
		
			
			
			
			
			type EventFailDouble struct {
    Event
    Reason string
}
			
			
			
			
			
			
			
		
			
			
			
			
			type EventFailMove struct {
    Event
    Reason string
}
			
			
			
			
			
			
			
		
			
			
			
			
			type EventFailSet struct {
    Event
    Name   string
    Reason string
}
			
			
			
			
			
			
			
		
			
			
			
			
			type EventOkBEI struct {
    Event
    Version int
    ID      map[string]string
}
			
			
			
			
			
			
			
		
			
			
			
			
			type EventOkChoose struct {
    Event
    Rolls []*ChooseRoll
}
			
			
			
			
			
			
			
		
			
			
			
			
			type EventOkDouble struct {
    Event
    Cube          CubeEvaluation
    Probabilities Probabilities
}
			
			
			
			
			
			
			
		
			
			
			
			
			type EventOkList struct {
    Event
    List []*ListEntry
}
			
			
			
			
			
			
			
		
			
			
			
			
			type EventOkMove struct {
    Event
    Moves []*Move
}
			
			
			
			
			
			
			
		
			
			
			
			
			type EventOkSet struct {
    Event
    Name  string
    Value string
}
			
			
			
			
			
			
			
		
			
			
			
			
			type ListEntry struct {
    Name        string
    Type        SettingType
    Description string
    Default     string
    Value       string
    Min         int
    Max         int
}
			
			
			
			
			
			
			
		
			
			
			
			
			type Move struct {
    Play          []*Play
    Probabilities Probabilities
}
			
			
			
			
			
			
			
		
			
			
			
			
			type Play struct {
    From int
    To   int
}
			
			
			
			
			
			
			
		
			
			
			
			
			type Probabilities struct {
    LoseBackgammon float64
    LoseGammon     float64
    Win            float64
    WinBackgammon  float64
    WinGammon      float64
}
			
			
			
			
			
			
			
		
			
			
			
			
			type SettingType int
			
				
				const (
    SettingBoolean SettingType = iota
    SettingInteger
    SettingString
)
			
			
			
			
			
			
			
		
			
			
			
			
			type State struct {
    Board []int
    Roll1 int
    Roll2 int
    Roll3 int
    Turn1 int
    Turn2 int
    CubeValue  int
    CubePlayer int
    Points1     int
    Points2     int
    TotalPoints int
    Crawford bool
    Jacoby   bool
    Murphy   bool
    Beavers  BeaversType
    Variant  int
    Entered1 bool
    Entered2 bool
}
			
			
			
			
			
			
				
				
				func DecodeState(state []int) (*State, error)