Documentation ¶
Index ¶
- Constants
- Variables
- type BoardPiece
- type BoardPieceAllST
- type BoardPieceMove
- type Flag
- func (f *Flag) Copy() (c *Flag)
- func (f *Flag) Formation(playix int) (formation *card.Formation, strenght int)
- func (f *Flag) FormationSize() (size int)
- func (f *Flag) HasFormation(player int) bool
- func (f *Flag) IsClaimable(player int, deckTroops []card.Troop) (isClaim bool, exCardixs []card.Card)
- func (f *Flag) IsEnvPlayable(player int) bool
- func (f *Flag) IsMoralePlayable(player int) bool
- func (f *Flag) IsTroopPlayable(player int) (isPlayable bool)
- func (f *Flag) PlayerFormationSize(playerix int) int
- func (f *Flag) String() string
- type FlagPlayer
- type Game
- func (g *Game) GiveUp(moves []*Move) (winner int)
- func (g *Game) IsAtBeginningOfHist() bool
- func (g *Game) LoadHist(hist *Hist)
- func (g *Game) Move(move *Move) (winner int, failedClaimsExs [9][]card.Card)
- func (g *Game) Pause(moves []*Move) (winner int)
- func (g *Game) Resume() (ok bool)
- func (g *Game) ScrollBackward() (ok bool)
- func (g *Game) ScrollForward() (winner int, ok bool)
- func (g *Game) Start(playerIDs [2]int, dealer int)
- type Hist
- type Move
- func CreateMoveCone(flagixs []int, mover int) *Move
- func CreateMoveDeserter(oldPos pos.Card, killedCardix, mover int, dishGuileMove *BoardPieceMove) (move *Move)
- func CreateMoveDouble(oldPos, newPos pos.Card, moveCardix, mover int, dishGuileMove *BoardPieceMove) (move *Move)
- func CreateMoveGivUp(conePos [10]pos.Cone, mover int) *Move
- func CreateMoveHand(cardix, flagix, mover int) (move *Move)
- func CreateMoveScout(dishMove, deckMove *BoardPieceMove, mover int) (move *Move)
- func CreateMoveScoutReturn(tacixs, troopixs []int, mover int) *Move
- func NewMove(mover int, moveType MoveType) (move *Move)
- type MoveType
- type MoveTypeAllST
- type Pos
- type PosCards
- type View
- type ViewAllST
- type ViewPos
Constants ¶
const (
//NOHandInit the starting numbers of cards.
NOHandInit = 7
)
Variables ¶
var ( //BoardPieceAll all the board piece types //Cone or Card. BoardPieceAll = newBoardPieceAllST() )
Functions ¶
This section is empty.
Types ¶
type BoardPiece ¶
type BoardPiece uint8
BoardPiece the board piece type card or cone.
func (BoardPiece) IsCard ¶
func (b BoardPiece) IsCard() bool
IsCard checks if the board piece is a Card.
func (BoardPiece) IsCone ¶
func (b BoardPiece) IsCone() bool
IsCone checks if the board piece is cone.
func (BoardPiece) String ¶
func (b BoardPiece) String() string
type BoardPieceAllST ¶
type BoardPieceAllST struct { Cone BoardPiece Card BoardPiece }
BoardPieceAllST the singleton of all the board pieces.
func (BoardPieceAllST) All ¶
func (m BoardPieceAllST) All() []BoardPiece
All return all the board piece Card and Cone
func (BoardPieceAllST) Names ¶
func (m BoardPieceAllST) Names() []string
Names returns all the names of the board pieces Card or Cone.
type BoardPieceMove ¶
type BoardPieceMove struct { Index int NewPos uint8 OldPos uint8 BoardPiece }
BoardPieceMove a single board piece move.
func CreateBPMoveDish ¶
func CreateBPMoveDish(cardix int, player int, oldPos pos.Card) *BoardPieceMove
CreateBPMoveDish create board piece move that moves a card to the dish.
func (*BoardPieceMove) IsEqual ¶
func (b *BoardPieceMove) IsEqual(o *BoardPieceMove) bool
IsEqual checks is to Board Piece Move is equal.
func (*BoardPieceMove) String ¶
func (b *BoardPieceMove) String() string
type Flag ¶
type Flag struct { Players [2]FlagPlayer Positions [2]pos.Card ConePos pos.Cone IsWon bool IsMud bool IsFog bool }
Flag a flag both players cards connected to a cone.
func (*Flag) FormationSize ¶
FormationSize the size of formation 3 or 4.
func (*Flag) HasFormation ¶
HasFormation returns true if the player have enough cards to make a formation.
func (*Flag) IsClaimable ¶
func (f *Flag) IsClaimable(player int, deckTroops []card.Troop) (isClaim bool, exCardixs []card.Card)
IsClaimable return true it the player can succesfully claim the flag.
func (*Flag) IsEnvPlayable ¶
IsEnvPlayable returns true if it is possible to play a enviroment tactic card on the flag by the player.
func (*Flag) IsMoralePlayable ¶
IsMoralePlayable returns true if it is possible to play a morale tactic card on the flag by the player.
func (*Flag) IsTroopPlayable ¶
IsTroopPlayable returns true if it is possible to play a troop on the flag by the player.
func (*Flag) PlayerFormationSize ¶
type FlagPlayer ¶
FlagPlayer the player in a flag.
func (FlagPlayer) Copy ¶
func (f FlagPlayer) Copy() (c FlagPlayer)
type Game ¶
Game a battleline game.
func (*Game) IsAtBeginningOfHist ¶
IsAtBeginningOfHist checks is a game position is at the begining of history.
func (*Game) LoadHist ¶
LoadHist loads a old history in to a game. the game postion is not upddate, use resume or scroll to use the history.
func (*Game) Resume ¶
Resume moves a game to the last postion of it history and wait for new moves. Returns ok if the game is not finished.
func (*Game) ScrollBackward ¶
ScrollBackward scrolls the game position one move back. returns false if at the end.
func (*Game) ScrollForward ¶
ScrollForward scrolls the game postion one move forward using history
type Hist ¶
Hist the history of a battleline game, every move made.
func (*Hist) RemovePause ¶
RemovePause remove the last move if it is pause.
type Move ¶
type Move struct { Mover int MoveType Moves []*BoardPieceMove }
Move a battleline move.
func CreateMoveCone ¶
CreateMoveCone creates a cone move.
func CreateMoveDeserter ¶
func CreateMoveDeserter(oldPos pos.Card, killedCardix, mover int, dishGuileMove *BoardPieceMove) (move *Move)
CreateMoveDeserter creates a deserter move.
func CreateMoveDouble ¶
func CreateMoveDouble(oldPos, newPos pos.Card, moveCardix, mover int, dishGuileMove *BoardPieceMove) (move *Move)
CreateMoveDouble creates a redeploy or traitor move.
func CreateMoveGivUp ¶
CreateMoveGivUp creates a give up move
func CreateMoveHand ¶
CreateMoveHand creates a card move from the hand to a flag.
func CreateMoveScout ¶
func CreateMoveScout(dishMove, deckMove *BoardPieceMove, mover int) (move *Move)
CreateMoveScout creates a scout move.
func CreateMoveScoutReturn ¶
CreateMoveScoutReturn creates a scout return move.
func (*Move) GetMoverAndType ¶
GetMoverAndType returns mover and move type. Works with nil.
type MoveType ¶
type MoveType uint8
MoveType a move type Cone,Hand,Init,Deck ... WARNING json of slice of uint8 behaves different that a single value see card or pos implementation if that is need.
func (MoveType) IsScout ¶
IsScout returns true if the move is part of the scout move. play scout and draw one card, draw second card and draw 3 card.
type MoveTypeAllST ¶
type MoveTypeAllST struct { Init MoveType Cone MoveType Deck MoveType Hand MoveType Scout1 MoveType Scout2 MoveType Scout3 MoveType ScoutReturn MoveType GiveUp MoveType Pause MoveType None MoveType }
MoveTypeAllST All the move types.
var ( //MoveTypeAll all the move types MoveTypeAll MoveTypeAllST )
func (MoveTypeAllST) Names ¶
func (m MoveTypeAllST) Names() []string
Names returns all the move types name.
type Pos ¶
type Pos struct { CardPos [71]pos.Card ConePos [10]pos.Cone PlayerReturned int CardsReturned [2]card.Card LastMoveType MoveType LastMover int LastMoveIx int }
Pos is a battleline game position.
func (*Pos) RemoveMove ¶
RemoveMove removes a move from postion.
func (*Pos) RemovePause ¶
RemovePause removes a pause move. Assume pause is always after initMove. Arg: lastMoveType the new last move type. Arg: lastMover the new last mover.
type PosCards ¶
PosCards cards sorted according to their current position
func NewPosCards ¶
NewPosCards creates a list of cards for every postion.
func (PosCards) SimDeckTroops ¶
SimDeckTroops returns the cards in the deck used to evalue flag claim. deck plus the cards on the hands.
type View ¶
type View uint8
View a view of the gane position.
func (View) DontSeePos ¶
DontSeePos return true if the position is not possible to see, by the viewer.
func (View) IsViewSeePlayer ¶
IsViewSeePlayer return true if the viewer can see the players card.
type ViewPos ¶
ViewPos a view of a game postion.
func NewViewPos ¶
NewViewPos create new view of a game postion.