Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrIllegalMove = errors.New("illegal move") ErrGameOverWhiteWin = errors.New("game over, white win") ErrGameOverBlackWin = errors.New("game over, black win") )
View Source
var CommandError = errors.New("wrong command")
Functions ¶
This section is empty.
Types ¶
type ConsoleMailBox ¶
type ConsoleMailBox struct {
// contains filtered or unexported fields
}
func (*ConsoleMailBox) Receive ¶
func (this *ConsoleMailBox) Receive() (r *PlayerState)
func (*ConsoleMailBox) Send ¶
func (this *ConsoleMailBox) Send(gs *GameState)
type Game ¶
type Game struct {
// contains filtered or unexported fields
}
func (*Game) LoadBoardInfo ¶
type GameState ¶
type GameState struct { State OutState `json:"state"` MyBoardInfo *MyBoardInfo `json:"boardInfo"` }
type MailBox ¶
type MailBox interface { Receive() *PlayerState Send(*GameState) }
func NewConsoleMailBox ¶
type MoveInfo ¶
func NewMoveInfo ¶
type MyBoardInfo ¶
func GameOverBoardInfo ¶
func GameOverBoardInfo(bi BoardInfo, side Side) (r *MyBoardInfo)
func NewMyBoardInfo ¶
func NewMyBoardInfo(bi BoardInfo, side Side) (r *MyBoardInfo)
func (*MyBoardInfo) FindUnit ¶
func (this *MyBoardInfo) FindUnit(pos Pos) (r UnitInfo)
func (*MyBoardInfo) ToJson ¶
func (this *MyBoardInfo) ToJson() (r []byte)
type PlayerState ¶
type PlayerStateParser ¶
type PlayerStateParser struct { }
func NewPlayerStateParser ¶
func NewPlayerStateParser() (r *PlayerStateParser)
func (*PlayerStateParser) Parse ¶
func (this *PlayerStateParser) Parse(msg string) (r *PlayerState)
type Room ¶
func NewRoomWithSlug ¶
func (*Room) BlackPlayer ¶
func (*Room) JoinableForPlay ¶
func (*Room) WhitePlayer ¶
type Unit ¶
type WebsocketMailBox ¶
type WebsocketMailBox struct {
// contains filtered or unexported fields
}
func NewWebsocketMailBox ¶
func NewWebsocketMailBox(ws *websocket.Conn) (r *WebsocketMailBox)
func (*WebsocketMailBox) Receive ¶
func (this *WebsocketMailBox) Receive() (r *PlayerState)
func (*WebsocketMailBox) Run ¶
func (this *WebsocketMailBox) Run()
func (*WebsocketMailBox) Send ¶
func (this *WebsocketMailBox) Send(gs *GameState)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.