pos

package
v0.0.0-...-0992052 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2017 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoPlayer = 2
)

Variables

View Source
var (
	//CardAll all the card postions.
	CardAll CardAllST
	//ConeAll all the cone postion.
	ConeAll ConeAllST
)

Functions

This section is empty.

Types

type Card

type Card uint8

Card postion.

func (Card) Flagix

func (c Card) Flagix() (flagix int)

Flagix returns the flag index or -1 if not a flag position

func (Card) IsInDeck

func (c Card) IsInDeck() bool

IsInDeck returns true if card postion is in deck.

func (Card) IsInDish

func (c Card) IsInDish() bool

IsInDish returns true if card postion is in Dish.

func (Card) IsOnHand

func (c Card) IsOnHand() bool

IsOnHand returns true is card postion is on either players hand.

func (Card) IsOnTable

func (c Card) IsOnTable() bool

IsOnTable returns true if card postion is on the table.

func (Card) MarshalJSON

func (c Card) MarshalJSON() (bytes []byte, err error)

MarshalJSON marshalls a card postion to json number to make a uint8 (byte) readable as a number.

func (Card) Player

func (c Card) Player() int

Player return the player of the card postion if none it returns -1

func (*Card) UnmarshalJSON

func (c *Card) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON unmarshalls a json number to a card postion. This is need because a of a slice of uint8 is confusing json unmarchal single value number slice is string.

type CardAllPlayerST

type CardAllPlayerST struct {
	Flags [9]Card
	Dish  Card
	Hand  Card
}

CardAllPlayerST player of card postion singleton.

type CardAllST

type CardAllST struct {
	Size      int
	DeckTroop Card
	DeckTac   Card
	Players   [2]CardAllPlayerST
}

CardAllST card postion all singleton.

type Cone

type Cone uint8

Cone the cone position.

func (Cone) IsWon

func (c Cone) IsWon() bool

IsWon reurns true if the cone is in a win postion.

func (Cone) MarshalJSON

func (c Cone) MarshalJSON() (bytes []byte, err error)

MarshalJSON marshalls cone to json int.

func (*Cone) UnmarshalJSON

func (c *Cone) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON unmarshalls json number to to a cone postion.

func (Cone) Winner

func (c Cone) Winner() int

Winner return the winner if any else 2

type ConeAllST

type ConeAllST struct {
	None    Cone
	Players [2]Cone
}

ConeAllST All cone postions singleton.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL