game

package
v0.0.0-...-f342b6d Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcScore

func CalcScore(g *PlaceItGame) int

Types

type ErrGameInvalidState

type ErrGameInvalidState struct {
	State  GameState
	Action string
}

func (*ErrGameInvalidState) Error

func (e *ErrGameInvalidState) Error() string

type ErrPlaceOutofBounds

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

func (*ErrPlaceOutofBounds) Error

func (e *ErrPlaceOutofBounds) Error() string

type GameState

type GameState int
const (
	DrawState GameState = iota
	PlaceState
	WinState
	LoseState
)

type PlaceItGame

type PlaceItGame struct {
	Slots      []int
	State      GameState
	CurDraw    int
	ValidSlots []int
	Deck       []int
	Score      int
}

func NewGame

func NewGame() PlaceItGame

func (*PlaceItGame) Draw

func (g *PlaceItGame) Draw() error

func (*PlaceItGame) Place

func (g *PlaceItGame) Place(i int) error

func (PlaceItGame) String

func (g PlaceItGame) String() string

Jump to

Keyboard shortcuts

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