Documentation
¶
Overview ¶
Package battleline contains the card game battleline.
Index ¶
- Constants
- func GobRegistor()
- func Save(game *Game, file *os.File, savePos bool) (err error)
- type Dish
- type Game
- func (game *Game) CalcPos()
- func (game *Game) Equal(other *Game) (equal bool)
- func (game *Game) GameMoveLoop(...)
- func (game *Game) Move(move int) (dealtix int, claimsFailExs [9][]int)
- func (game *Game) MoveHand(cardix int, moveix int) (dealtix int, dishixs []int)
- func (game *Game) Pass()
- func (game *Game) Quit(playerix int)
- func (game *Game) ResetGame() (moves [][2]int)
- func (game *Game) Start(starter int)
- type GamePos
- type Hand
- type Move
- type MoveCardFlag
- type MoveClaim
- type MoveDeck
- type MoveDeserter
- type MoveRedeploy
- type MoveScoutReturn
- type MoveTraitor
- type TroopTac
- type Turn
Constants ¶
const ( //NOFlags is the numbers of flags NOFlags = 9 //NOHandInit number of cards in init hand. NOHandInit = 7 //SMPass is the move pass SMPass = -1 //SMGiveUp is the move give up SMGiveUp = -2 )
const ( //TURNFlag player claim flags. TURNFlag = 0 //TURNHand player plays a card from hand. TURNHand = 1 //TURNScout2 player picks second of tree scout cards. TURNScout2 = 2 //TURNScout1 player picks last of tree scout cards. TURNScout1 = 3 //TURNScoutR player return 3 cards to decks. TURNScoutR = 4 //TURNDeck playe pick a card from a deck. TURNDeck = 5 //TURNFinish game is over. TURNFinish = 6 //TURNQuit player quit game is over. TURNQuit = 7 //DECKTac the tactic card deck. DECKTac = 1 //DECKTroop the troop card deck. DECKTroop = 2 //REDeployDishix REDeployDishix = -1 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Game ¶
type Game struct { PlayerIds [2]int Pos *GamePos InitDeckTac deck.Deck InitDeckTroop deck.Deck Starter int Moves [][2]int }
Game The struct that holds all information about a game
func (*Game) CalcPos ¶
func (game *Game) CalcPos()
CalcPos calculate the current posistion from the initial position and the moves. The new position replace the old position.
func (*Game) GameMoveLoop ¶
func (*Game) Move ¶
Move makes a none card move. Claim flags, Getting or returning cards to deck. dealtix the card in deal move. claimFailMap the failed claim map in a claim flag move. Is never nil.
func (*Game) MoveHand ¶
MoveHand play a card from hand. dealtix the delt cardix when the scout card is played. dishixs the dished cards witch may results of a redeploy or desert of the mud card. in case of redeploy it also holds the redeploy card if it is dished.
type GamePos ¶
type GamePos struct { Flags [NOFlags]*flag.Flag Dishs [2]*Dish Hands [2]*Hand DeckTac deck.Deck DeckTroop deck.Deck Turn Info string }
GamePos a game position.
func NewGamePos ¶
func NewGamePos() *GamePos
type Hand ¶
type Hand TroopTac
Hand a battleline hand.
type MoveCardFlag ¶
MoveCardFlag the place a card on a flag move. Its is just int for the flag index.
func NewMoveCardFlag ¶
func NewMoveCardFlag(flagix int) *MoveCardFlag
func (MoveCardFlag) Copy ¶
func (m MoveCardFlag) Copy() (c Move)
func (MoveCardFlag) MoveEqual ¶
func (m MoveCardFlag) MoveEqual(other Move) (equal bool)
type MoveClaim ¶
MoveClaim the claim flags move. The slice contain the list of flags to claim.
func NewMoveClaim ¶
type MoveDeserter ¶
MoveDeserter the deserter move. The flag and the index of the card to kill.
func NewMoveDeserter ¶
func NewMoveDeserter(flagix int, cardix int) *MoveDeserter
func (MoveDeserter) Copy ¶
func (m MoveDeserter) Copy() (c Move)
func (MoveDeserter) MoveEqual ¶
func (m MoveDeserter) MoveEqual(other Move) (equal bool)
type MoveRedeploy ¶
type MoveRedeploy struct { OutFlag int OutCard int InFlag int //may be -1 no flag goes to dish. JsonType string }
MoveRedeploy the redeploy move, the flag and card index of the card to move and the destination flag.
func NewMoveRedeploy ¶
func NewMoveRedeploy(outFlagix int, outCardix int, inFlagix int) *MoveRedeploy
func (MoveRedeploy) Copy ¶
func (m MoveRedeploy) Copy() (c Move)
func (MoveRedeploy) MoveEqual ¶
func (m MoveRedeploy) MoveEqual(other Move) (equal bool)
type MoveScoutReturn ¶
MoveScoutReturn the scout return move. The tactic cards and the troop cards. It is first in last out. The first card of the slice will be delt last.
func NewMoveScoutReturn ¶
func NewMoveScoutReturn(tac []int, troop []int) *MoveScoutReturn
func (MoveScoutReturn) Copy ¶
func (m MoveScoutReturn) Copy() Move
func (MoveScoutReturn) Equal ¶
func (m MoveScoutReturn) Equal(other MoveScoutReturn) (equal bool)
func (MoveScoutReturn) MoveEqual ¶
func (m MoveScoutReturn) MoveEqual(other Move) (equal bool)
type MoveTraitor ¶
MoveTraitor the traitor move, the flag and card index of the card to move and destination flag.
func NewMoveTraitor ¶
func NewMoveTraitor(outFlagix int, outCardix int, inFlagix int) *MoveTraitor
func (MoveTraitor) Copy ¶
func (m MoveTraitor) Copy() (c Move)
func (MoveTraitor) MoveEqual ¶
func (m MoveTraitor) MoveEqual(other Move) (equal bool)