Documentation
¶
Index ¶
- Constants
- Variables
- type Builder
- func (b *Builder) Create(options *bg.BoardGameOptions) (bg.BoardGame, error)
- func (b *Builder) CreateWithBGN(options *bg.BoardGameOptions) (bg.BoardGameWithBGN, error)
- func (b *Builder) Info() *bg.BoardGameInfo
- func (b *Builder) Key() string
- func (b *Builder) Load(game *bgn.Game) (bg.BoardGameWithBGN, error)
- type Carcassonne
- type CarcassonneMoreOptions
- type CarcassonneSnapshotData
- type PlaceTileActionDetails
- type PlaceTokenActionDetails
- type TileActionDetails
Constants ¶
const ( FarmNotchA = "A" FarmNotchB = "B" )
Farm notch which is a piece of a farm side
const ( FarmSideTopA = SideTop + FarmNotchA FarmSideTopB = SideTop + FarmNotchB FarmSideRightA = SideRight + FarmNotchA FarmSideRightB = SideRight + FarmNotchB FarmSideBottomA = SideBottom + FarmNotchA FarmSideBottomB = SideBottom + FarmNotchB FarmSideLeftA = SideLeft + FarmNotchA FarmSideLeftB = SideLeft + FarmNotchB )
Farm sides of a tile
TopA TopB
—— ——
LeftB | | RightA
LeftA | | RightB
—— ——
BottomB BottomA
const ( ActionPlaceTile = "PlaceTile" ActionPlaceToken = "PlaceToken" ActionRotateTileRight = "RotateTileRight" ActionRotateTileLeft = "RotateTileLeft" )
Action types
const ( SideTop = "Top" SideRight = "Right" SideBottom = "Bottom" SideLeft = "Left" )
Sides of a tile
Top
——
Left | | Right
——
Bottom
const ( Farm = "Farm" City = "City" Road = "Road" Cloister = "Cloister" NilStructure = "NilStructure" )
Structure types
const ( Farmer = "Farmer" Knight = "Knight" Thief = "Thief" Monk = "Monk" )
Token types
const OutOfBounds = 999
Variables ¶
var ( FarmSides = []string{FarmSideTopA, FarmSideTopB, FarmSideRightA, FarmSideRightB, FarmSideBottomA, FarmSideBottomB, FarmSideLeftA, FarmSideLeftB} AcrossFarmSide = map[string]string{FarmSideTopA: FarmSideBottomB, FarmSideTopB: FarmSideBottomA, FarmSideRightA: FarmSideLeftB, FarmSideRightB: FarmSideLeftA, FarmSideBottomA: FarmSideTopB, FarmSideBottomB: FarmSideTopA, FarmSideLeftA: FarmSideRightB, FarmSideLeftB: FarmSideRightA} )
var ( Sides = []string{SideTop, SideRight, SideBottom, SideLeft} ClockwiseSide = map[string]string{SideTop: SideRight, SideRight: SideBottom, SideBottom: SideLeft, SideLeft: SideTop} CounterClockwiseSide = map[string]string{SideTop: SideLeft, SideLeft: SideBottom, SideBottom: SideRight, SideRight: SideTop} AcrossSide = map[string]string{SideTop: SideBottom, SideRight: SideLeft, SideBottom: SideTop, SideLeft: SideRight} )
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct{}
func (*Builder) CreateWithBGN ¶
func (b *Builder) CreateWithBGN(options *bg.BoardGameOptions) (bg.BoardGameWithBGN, error)
func (*Builder) Info ¶ added in v1.1.6
func (b *Builder) Info() *bg.BoardGameInfo
type Carcassonne ¶
type Carcassonne struct {
// contains filtered or unexported fields
}
func NewCarcassonne ¶
func NewCarcassonne(options *bg.BoardGameOptions) (*Carcassonne, error)
func (*Carcassonne) Do ¶
func (c *Carcassonne) Do(action *bg.BoardGameAction) error
func (*Carcassonne) GetBGN ¶
func (c *Carcassonne) GetBGN() *bgn.Game
func (*Carcassonne) GetSnapshot ¶
func (c *Carcassonne) GetSnapshot(team ...string) (*bg.BoardGameSnapshot, error)
type CarcassonneMoreOptions ¶
type CarcassonneMoreOptions struct {
Seed int64
}
CarcassonneMoreOptions are the additional options for creating a game of Carcassonne
type CarcassonneSnapshotData ¶
type CarcassonneSnapshotData struct {
PlayTile *tile
LastPlacedTiles map[string]*tile
Board []*tile
BoardTokens []*token
Tokens map[string]int
Scores map[string]int
TilesRemaining int
}
CarcassonneSnapshotData is the game data unique to Carcassonne
type PlaceTileActionDetails ¶
type PlaceTileActionDetails struct {
// X and Y location where to place the tile
X, Y int
// Tile is the tile being placed
Tile TileActionDetails
}
PlaceTileActionDetails is the action details for placing a tile
type PlaceTokenActionDetails ¶
type PlaceTokenActionDetails struct {
// Pass set to pass placing a token
Pass bool
// X and Y location where to place the token
X, Y int
// Type is the type of token to place
Type string
// Side is the side to place
Side string
}
PlaceTokenActionDetails is the action details for placing a token
