game

package
v0.0.0-...-c13e63e Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PhaseLobby      = "lobby"
	PhaseBrew       = "brew"
	PhaseEvaluation = "evaluation"
)
View Source
const (
	White  = 'w'
	Orange = 'o'
	Green  = 'g'
	Red    = 'r'
	Blue   = 'u'
	Black  = 'b'
	Yellow = 'y'
	Purple = 'p'
)
View Source
const BustThreshold = 7
View Source
const MaxPlayers = 4
View Source
const NumRounds = 9

Variables

View Source
var Board = []Space{
	{Value: 0, VictoryPoints: 0},
	{Value: 1, VictoryPoints: 0},
	{Value: 2, VictoryPoints: 0},
	{Value: 3, VictoryPoints: 0},
	{Value: 4, VictoryPoints: 0},
	{Value: 5, VictoryPoints: 0, Ruby: true},
	{Value: 6, VictoryPoints: 1},
	{Value: 7, VictoryPoints: 1},
	{Value: 8, VictoryPoints: 1},
	{Value: 9, VictoryPoints: 1, Ruby: true},
	{Value: 10, VictoryPoints: 2},
	{Value: 11, VictoryPoints: 2},
	{Value: 12, VictoryPoints: 2},
	{Value: 13, VictoryPoints: 2, Ruby: true},
	{Value: 14, VictoryPoints: 3},
	{Value: 15, VictoryPoints: 3},
	{Value: 15, VictoryPoints: 3, Ruby: true},
	{Value: 16, VictoryPoints: 3},
	{Value: 16, VictoryPoints: 4},
	{Value: 17, VictoryPoints: 4},
	{Value: 17, VictoryPoints: 4, Ruby: true},
	{Value: 18, VictoryPoints: 4},
	{Value: 18, VictoryPoints: 5},
	{Value: 19, VictoryPoints: 5},
	{Value: 19, VictoryPoints: 5, Ruby: true},
	{Value: 20, VictoryPoints: 5},
	{Value: 20, VictoryPoints: 6},
	{Value: 21, VictoryPoints: 6},
	{Value: 21, VictoryPoints: 6, Ruby: true},
	{Value: 22, VictoryPoints: 7},
	{Value: 22, VictoryPoints: 7, Ruby: true},
	{Value: 23, VictoryPoints: 7},
	{Value: 23, VictoryPoints: 8},
	{Value: 24, VictoryPoints: 8},
	{Value: 24, VictoryPoints: 8, Ruby: true},
	{Value: 25, VictoryPoints: 9},
	{Value: 25, VictoryPoints: 9, Ruby: true},
	{Value: 26, VictoryPoints: 9},
	{Value: 27, VictoryPoints: 10},
	{Value: 27, VictoryPoints: 10, Ruby: true},
	{Value: 28, VictoryPoints: 11},
	{Value: 28, VictoryPoints: 11, Ruby: true},
	{Value: 29, VictoryPoints: 11},
	{Value: 29, VictoryPoints: 12},
	{Value: 30, VictoryPoints: 12},
	{Value: 30, VictoryPoints: 12, Ruby: true},
	{Value: 31, VictoryPoints: 12},
	{Value: 31, VictoryPoints: 13},
	{Value: 32, VictoryPoints: 13},
	{Value: 32, VictoryPoints: 13, Ruby: true},
	{Value: 33, VictoryPoints: 14},
	{Value: 33, VictoryPoints: 14, Ruby: true},
	{Value: 35, VictoryPoints: 15},
}
View Source
var Prices = []IngredientPrice{

	{Ingredient: Ingredient{Type: Orange, Value: 1}, Price: 3},

	{Ingredient: Ingredient{Type: Green, Value: 1}, Price: 4},
	{Ingredient: Ingredient{Type: Green, Value: 2}, Price: 8},
	{Ingredient: Ingredient{Type: Green, Value: 4}, Price: 14},

	{Ingredient: Ingredient{Type: Red, Value: 1}, Price: 6},
	{Ingredient: Ingredient{Type: Red, Value: 2}, Price: 10},
	{Ingredient: Ingredient{Type: Red, Value: 4}, Price: 16},

	{Ingredient: Ingredient{Type: Blue, Value: 1}, Price: 5},
	{Ingredient: Ingredient{Type: Blue, Value: 2}, Price: 10},
	{Ingredient: Ingredient{Type: Blue, Value: 4}, Price: 19},

	{Ingredient: Ingredient{Type: Black, Value: 1}, Price: 10},

	{Ingredient: Ingredient{Type: Yellow, Value: 1}, Price: 8},
	{Ingredient: Ingredient{Type: Yellow, Value: 2}, Price: 12},
	{Ingredient: Ingredient{Type: Yellow, Value: 4}, Price: 18},

	{Ingredient: Ingredient{Type: Purple, Value: 1}, Price: 9},
}
View Source
var RatTailLocations = []int{2, 5, 8, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49}

RatTailLocations lists all victory point values that are preceded by a rat tail.

Functions

This section is empty.

Types

type Game

type Game struct {
	Players []Player
	Round   int
	Phase   string
}

func (*Game) AddPlayer

func (g *Game) AddPlayer(name string) error

func (*Game) BeginEvaluation

func (g *Game) BeginEvaluation() error

func (*Game) Draw

func (g *Game) Draw(playerId int) error

func (*Game) IsFull

func (g *Game) IsFull() bool

func (*Game) Start

func (g *Game) Start() error

func (*Game) StartNormalBrew

func (g *Game) StartNormalBrew() error

type Ingredient

type Ingredient struct {
	Type  byte
	Value int
}

type IngredientPrice

type IngredientPrice struct {
	Ingredient
	Price int
}

type IngredientSpace

type IngredientSpace struct {
	Ingredient
	Space int
}

type Player

type Player struct {
	Name        string
	Potion      Potion
	Bag         []Ingredient
	Options     []Ingredient
	Buys        [][]Ingredient
	Score       int
	Rubies      int
	PotionLevel int
	RatTails    int
	Flask       bool
	Done        bool
}

func (*Player) PlaceIngredient

func (p *Player) PlaceIngredient(ingredient Ingredient) error

func (*Player) RollDice

func (p *Player) RollDice()

func (*Player) TakeFromBag

func (p *Player) TakeFromBag() Ingredient

type Potion

type Potion struct {
	StartingSpace int
	Ingredients   []IngredientSpace
}

func (*Potion) GetNextSpace

func (p *Potion) GetNextSpace() int

GetNextSpace returns the index of the next space on the board after the last ingredient in the Potion.

func (*Potion) IsBusted

func (p *Potion) IsBusted() bool

func (*Potion) IsFull

func (p *Potion) IsFull() bool

type Space

type Space = struct {
	Value         int
	VictoryPoints int
	Ruby          bool
}

Jump to

Keyboard shortcuts

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