lostcities

package
v0.0.0-...-e36e409 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEVELOP_POINT = 20
	BONUS_COUNT   = 8
	BONUS_POINT   = 20

	PLAYER      = 2
	COLOR       = 5
	CARD        = 12
	CARD_DOUBLE = 3
	CARD_POINT  = CARD - CARD_DOUBLE
)

Variables

View Source
var (
	EMPTY_CARD = Card{-1}
)
View Source
var Instance = &game.Game{
	Id:   "lost-cities",
	Name: "失落的城市",
	Player: game.Range{
		Min: 2,
		Max: 2,
	},
	Options: nil,
	NewEvent: func() game.Event {
		e := Event{}
		e.BaseEvent.ResponseStream = make(chan game.Response, 5)
		return &e
	},
	OnEvent: func(e game.Event) game.Response {
		eventStream <- e
		return e.GetResponse()
	},
}

Functions

This section is empty.

Types

type Card

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

func (Card) Color

func (c Card) Color() int

func (Card) IsDouble

func (c Card) IsDouble() bool

func (Card) Point

func (c Card) Point() int

type Event

type Event struct {
	game.BaseEvent

	Play bool
	// Play card
	Card Card
	Drop bool
	// Draw card
	FromDeck bool // Or from drop
	Color    int  // Only available when from deck
}

type Game

type Game struct {
	Thread  space.Publisher
	Current int
	Deck    []Card     // [index] from 0 (top)
	Board   [][][]Card // [player][color][index] from 0 (oldest)
	Drop    [][]Card   // [color][index] from 0 (oldest)
	Hand    [][]Card   // [player][index] no order, by default 0 (oldest)
}

func NewStandardGame

func NewStandardGame() *Game

func (*Game) DrawCard

func (g *Game) DrawCard(player int, count int) []Card

func (*Game) DrawDropCard

func (g *Game) DrawDropCard(player int, color int) Card

func (*Game) DropCard

func (g *Game) DropCard(player int, card Card)

func (*Game) Play

func (g *Game) Play(event *Event) game.Response

func (*Game) PlayCard

func (g *Game) PlayCard(player int, card Card)

Jump to

Keyboard shortcuts

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