Documentation ¶
Overview ¶
Package tables contains the tables server. Keeping track of the games being played.
Index ¶
- Constants
- func IsPlaying(ids [2]int, games map[int]*pub.GameData) bool
- func NewGameData(opp int, watch *pub.WatchChCl) (g *pub.GameData)
- func NewMoveBench(view *MoveBenchView, ini bool) (move *pub.MoveBench)
- type BenchPos
- type FinishTableData
- type Flag
- type MoveBenchInit
- type MoveBenchPos
- type MoveBenchView
- type MoveClaimView
- type MoveDeserterView
- type MoveInit
- type MoveInitPos
- type MovePass
- type MoveQuit
- type MoveRedeployView
- type MoveSave
- type MoveScoutReturnView
- type PlayPos
- type SaveGames
- type Server
Constants ¶
const (
//SAVEGamesFile the file where unfinished games are saved.
SAVEGamesFile = "data/savegames.gob"
)
Variables ¶
This section is empty.
Functions ¶
func NewGameData ¶
NewGameData create a new GameData pointer.
func NewMoveBench ¶
func NewMoveBench(view *MoveBenchView, ini bool) (move *pub.MoveBench)
Types ¶
type BenchPos ¶
type BenchPos struct { Flags [bat.NOFlags]*Flag //Player 0 flags DishTroops [2][]int DishTacs [2][]int Hands [2][]bool DeckTacs int DeckTroops int Ids [2]int }
BenchPos the complete data that describe a game position for a watcher.
type FinishTableData ¶
type FinishTableData struct {
// contains filtered or unexported fields
}
FinishTableData the data structur send on the finish channel.
type Flag ¶
type Flag struct { OppFlag bool NeuFlag bool PlayFlag bool OppTroops []int OppEnvs []int PlayEnvs []int PlayTroops []int }
Flag a battleline flag.
type MoveBenchInit ¶
MoveBenchInit the first move in new game.
func NewMoveBenchInit ¶
func NewMoveBenchInit(ids [2]int) *MoveBenchInit
func (MoveBenchInit) Copy ¶
func (m MoveBenchInit) Copy() (c bat.Move)
type MoveBenchPos ¶
MoveBenchPos the first move when restarting a game or when joining a game.
func NewMoveBenchPos ¶
func NewMoveBenchPos(pos *BenchPos) *MoveBenchPos
func (MoveBenchPos) Copy ¶
func (m MoveBenchPos) Copy() (c bat.Move)
type MoveBenchView ¶
MoveBenchView the information send from the table to the bench. The informationn is then relayed to all watchers. As watchers can be new it must always contain a init move and a move unless it is the first move in a new game. This is because we can always have new watchers.
type MoveClaimView ¶
type MoveClaimView struct { Claim []int //The players claimed this flags Claimed []int //The players claimed flag that was not rejected Win bool FailsExs [9][]int JsonType string }
MoveClaimView the claim view contain the opriginal claim move and the result. The claimed flags, if the game was won and evt. information from failed claims.
func NewMoveClaimView ¶
func (MoveClaimView) Copy ¶
func (m MoveClaimView) Copy() (c bat.Move)
func (MoveClaimView) Equal ¶
func (m MoveClaimView) Equal(other MoveClaimView) (equal bool)
type MoveDeserterView ¶
type MoveDeserterView struct { Move *bat.MoveDeserter Dishixs []int JsonType string }
MoveReployView the redeploy move view.
func NewMoveDeserterView ¶
func NewMoveDeserterView(move *bat.MoveDeserter, dishixs []int) (m *MoveDeserterView)
func (MoveDeserterView) Copy ¶
func (m MoveDeserterView) Copy() (c bat.Move)
type MoveInit ¶
MoveInit the initial move in a new game. Just the 7 cards the player get.
func NewMoveInit ¶
type MoveInitPos ¶
MoveInitPos is the first move in a resumed game.
func NewMoveInitPos ¶
func NewMoveInitPos(pos *PlayPos) *MoveInitPos
func (MoveInitPos) Copy ¶
func (m MoveInitPos) Copy() (c bat.Move)
type MovePass ¶
type MovePass struct {
JsonType string
}
MovePass is the pass move.
func NewMovePass ¶
func NewMovePass() *MovePass
type MoveQuit ¶
type MoveQuit struct {
JsonType string
}
MoveQuit the quit move.
func NewMoveQuit ¶
func NewMoveQuit() *MoveQuit
type MoveRedeployView ¶
type MoveRedeployView struct { Move *bat.MoveRedeploy RedeployDishixs []int JsonType string }
MoveReployView the redeploy move view.
func NewMoveRedeployView ¶
func NewMoveRedeployView(move *bat.MoveRedeploy, dishixs []int) (m *MoveRedeployView)
func (MoveRedeployView) Copy ¶
func (m MoveRedeployView) Copy() (c bat.Move)
type MoveSave ¶
type MoveSave struct {
JsonType string
}
MoveSave the save move.
func NewMoveSave ¶
func NewMoveSave() *MoveSave
type MoveScoutReturnView ¶
MoveScoutReturnView the scout return move view. the scout return move as view by the opponent and the public.
func NewMoveScoutReturnView ¶
func NewMoveScoutReturnView(scout bat.MoveScoutReturn) (m *MoveScoutReturnView)
func (MoveScoutReturnView) Copy ¶
func (m MoveScoutReturnView) Copy() (c bat.Move)
type PlayPos ¶
type PlayPos struct { Flags [bat.NOFlags]*Flag OppDishTroops []int OppDishTacs []int DishTroops []int DishTacs []int OppHand []bool //true equal troop false equal tactic. Hand []int DeckTacs int DeckTroops int }
PlayPos a player position for starting a old game.
type SaveGames ¶
SaveGames the data structur for saved games used to save as Gob.
func LoadSaveGames ¶
LoadSaveGames loads the save games.
func NewSaveGames ¶
func NewSaveGames() (sg *SaveGames)
NewSaveGames creates a SaveGames structur. To use Gob we single structur tow same multible games.
type Server ¶
type Server struct { StartGameChCl *pub.StartGameChCl // contains filtered or unexported fields }
Server the battleline tables server Keeps track of games being played. Who is playing, who is watching and saved unfinished games. It here you ask to start a game.