game

package
v0.0.0-...-85a0464 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cycler

type Cycler struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewCycler

func NewCycler(elements []int) *Cycler

func (*Cycler) Current

func (c *Cycler) Current() int

func (*Cycler) ForEach

func (c *Cycler) ForEach(function func(int))

func (*Cycler) Next

func (c *Cycler) Next() int

type Deck

type Deck struct {
	// contains filtered or unexported fields
}

func NewDeck

func NewDeck() *Deck

func (*Deck) BottomDrawOne

func (d *Deck) BottomDrawOne() int

func (*Deck) Draw

func (d *Deck) Draw(amount int) []int

func (*Deck) DrawOne

func (d *Deck) DrawOne() int

func (*Deck) NoPlanes

func (d *Deck) NoPlanes() bool

type Direction

type Direction int
const (
	TOP Direction
	BOTTOM
	LEFT
	RIGHT
)

type Game

type Game struct {
	// contains filtered or unexported fields
}
0  1  2  3  4  5  6  7  8  9

0 O O X O O O O O O O 1 X X X X X O O O O O 2 O O X O O O O * O O 3 O X X X O * * * * * 4 O O O O O O O * O O 5 O O O O O O * * * O 6 O O O O O O O O O O 7 O O O O O O O O O O 8 O O O O O O O O O O 9 O O O O O O O O O O

func New

func New(players []Player) *Game

func (*Game) Current

func (g *Game) Current() *playerController

func (*Game) Deck

func (g *Game) Deck() *Deck

func (Game) ExtractState

func (g Game) ExtractState(player *playerController) *State

func (*Game) Next

func (g *Game) Next() *playerController

func (*Game) Pile

func (g *Game) Pile() *Pile

func (*Game) Players

func (g *Game) Players() *PlayerIterator

type Pile

type Pile struct {
	// contains filtered or unexported fields
}

func NewPile

func NewPile() *Pile

func (*Pile) Add

func (p *Pile) Add(plane int)

func (*Pile) BottomDrawOne

func (d *Pile) BottomDrawOne() int

func (*Pile) ReplaceTop

func (p *Pile) ReplaceTop(plane int)

func (*Pile) Tiles

func (p *Pile) Tiles() []int

func (*Pile) Top

func (p *Pile) Top() int

type Plane

type Plane struct {
	// contains filtered or unexported fields
}

func (*Plane) CanGeneratePlan

func (plan *Plane) CanGeneratePlan() bool

func (*Plane) NumberList

func (plan *Plane) NumberList() []int

func (*Plane) String

func (plan *Plane) String() string

type Player

type Player interface {
	PlayerID() int
	NickName() string
	Play(planes []int, gameState State) (int, error)
	// contains filtered or unexported methods
}

type PlayerIterator

type PlayerIterator struct {
	// contains filtered or unexported fields
}

func (*PlayerIterator) Current

func (i *PlayerIterator) Current() *playerController

func (*PlayerIterator) ForEach

func (i *PlayerIterator) ForEach(function func(player *playerController))

func (*PlayerIterator) GetPlayerController

func (i *PlayerIterator) GetPlayerController(id int) *playerController

func (*PlayerIterator) Next

func (i *PlayerIterator) Next() *playerController

type Point

type Point struct {
	// contains filtered or unexported fields
}

func (Point) Number

func (p Point) Number() int

func (Point) PlaneList

func (p Point) PlaneList(direction Direction) []*Point

func (*Point) ValidHead

func (p *Point) ValidHead(direction Direction) bool

type State

type State struct {
	CurrentPlayerHand []int
	PlayerSequence    []*playerController
}

func (State) String

func (s State) String() string

Jump to

Keyboard shortcuts

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