Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatMessage ¶
type ChatMessage struct {
Message string
}
type InitMessage ¶
type InitMessage struct { Update *UpdateMessage Size *domain.FieldSize }
InitMessage contains all info to initialize player.
type JoinMessage ¶
type JoinMessage struct {
Nick string
}
type LeaveMessage ¶
type LeaveMessage struct{}
type Player ¶
type Player interface { // UID must return unique player id. // This is must be same for every call. UID() uuid.UUID Init(InitMessage) Update(UpdateMessage) }
type Server ¶
type Server interface { // Connect must be called once and must be the first call. Connect(Player) Join(Player, JoinMessage) Leave(Player, LeaveMessage) Turn(Player, TurnMessage) Chat(Player, ChatMessage) // Disconnect must be called once and must be the last call. Disconnect(Player) }
Server is an interface for player to use. All calls must be sequential, i.e. parallel calls are not allowed.
type TurnMessage ¶
type TurnMessage struct {
Direction domain.BaseDirection
}
type UpdateCell ¶
UpdateCell contains update for ID and Food at specified Location.
type UpdateChat ¶
type UpdateMessage ¶
type UpdateMessage struct { IDUpdates []UpdateID CellUpdates []UpdateCell ChatUpdates []UpdateChat }
UpdateMessage contains all updates.
Click to show internal directories.
Click to hide internal directories.