Documentation ¶
Overview ¶
Package fibs provides a FIBS.com (online backgammon) client library.
In addition to the standard FIBS commands, the following internal custom commands are available:
- `watch` - Watch a random game - `tv` - Watch random games continuously
Index ¶
- Constants
- Variables
- type Board
- func (b *Board) AddPreMove(from int, to int) bool
- func (b *Board) Draw()
- func (b *Board) GetIntState() []int
- func (b *Board) GetPreMoves() [][2]int
- func (b *Board) GetSelection() (num int, space int)
- func (b *Board) GetState() string
- func (b *Board) GetStringState() []string
- func (b *Board) GetValidMoves(from int) [][]int
- func (b *Board) Move(player int, f string, t string)
- func (b *Board) PlayerBarSpace() int
- func (b *Board) PlayerBearOffSpace() int
- func (b *Board) PlayerHomeSpaces() (int, int)
- func (b *Board) PlayerPieceAreHome() bool
- func (b *Board) Render() []byte
- func (b *Board) ResetMoves()
- func (b *Board) ResetPreMoves()
- func (b *Board) ResetSelection()
- func (b *Board) SetSelection(num int, space int)
- func (b *Board) SetState(state string)
- func (b *Board) SimplifyMoves()
- func (b *Board) ValidMove(f int, t int) bool
- type Client
- type EventBoardState
- type EventDraw
- type EventMessage
- type EventMove
- type EventWho
- type WhoInfo
Constants ¶
View Source
const ( StateLength = iota StatePlayerScore StateOpponentScore StateBoardSpace0 )
View Source
const ( StatePlayerName = iota StateOpponentName )
View Source
const ( StateTurn = 29 + iota StatePlayerDice1 StatePlayerDice2 StateOpponentDice1 StateOpponentDice2 StateDoublingValue StatePlayerMayDouble StateOpponentMayDouble StateWasDoubled StatePlayerColor StateDirection StateObsoleteHome StateObsoleteBar StatePlayerHome StateOpponentHome StatePlayerBar StateOpponentBar StateMovablePieces StateObsoletePlayerForced StateObsoleteOpponentForced StateRedoubles )
View Source
const (
BoxDrawingsLightVertical = '|'
)
View Source
const (
SpaceUnknown = -1
)
Variables ¶
View Source
var ( TypeWelcome = []byte("1") TypeOwnInfo = []byte("2") TypeMOTD = []byte("3") TypeEndMOTD = []byte("4") TypeWhoInfo = []byte("5") TypeEndWhoInfo = []byte("6") TypeLogin = []byte("7") TypeLogout = []byte("8") TypeMsg = []byte("9") TypeMsgDelivered = []byte("10") TypeMsgSaved = []byte("11") TypeSay = []byte("12") TypeShout = []byte("13") TypeWhisper = []byte("14") TypeKibitz = []byte("15") TypeYouSay = []byte("16") TypeYouShout = []byte("17") TypeYouWhisper = []byte("18") TypeYouKibitz = []byte("19") TypeBoardState = []byte("board:") )
View Source
var ( StatusWriter io.Writer GameWriter io.Writer )
View Source
var Debug = 0
Debug controls the level of debug information to print.
View Source
var DefaultProxyAddress = ""
Functions ¶
This section is empty.
Types ¶
type Board ¶
type Board struct { Premovefrom map[int]int Premoveto map[int]int sync.Mutex // contains filtered or unexported fields }
func (*Board) GetIntState ¶
func (*Board) GetPreMoves ¶
func (*Board) GetSelection ¶
func (*Board) GetValidMoves ¶
func (*Board) PlayerBarSpace ¶
func (*Board) PlayerBearOffSpace ¶
func (*Board) PlayerHomeSpaces ¶
func (*Board) PlayerPieceAreHome ¶
func (*Board) ResetMoves ¶
func (b *Board) ResetMoves()
func (*Board) ResetPreMoves ¶
func (b *Board) ResetPreMoves()
func (*Board) ResetSelection ¶
func (b *Board) ResetSelection()
func (*Board) SetSelection ¶
func (*Board) SimplifyMoves ¶
func (b *Board) SimplifyMoves()
type Client ¶
type Client struct { In chan []byte Out chan []byte Event chan interface{} Username string Password string Board *Board // contains filtered or unexported fields }
func (*Client) CallTELNET ¶
func (c *Client) CallTELNET(ctx telnet.Context, w telnet.Writer, r telnet.Reader)
CallTELNET is called when a connection is made with the server.
func (*Client) GetAllWhoInfo ¶
func (*Client) WatchRandomGame ¶
func (c *Client) WatchRandomGame()
type EventBoardState ¶
type EventMessage ¶
type EventMessage struct {
Message string
}
Click to show internal directories.
Click to hide internal directories.