ec

package
v0.0.0-...-0456d50 Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package ec implements the logic for Empyrean Challenge

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Abandon

type Abandon struct {
	Line     int
	Location coordinates.Coordinates // location to be abandoned
}

func (*Abandon) Execute

func (o *Abandon) Execute() error

type AssembleFactoryGroup

type AssembleFactoryGroup struct {
	Line        int
	Id          int        // id of unit being ordered
	Quantity    int        // number of units to assemble
	Unit        units.Unit // factory units to assemble
	Manufacture units.Unit // product unit to be manufactured
}

func (*AssembleFactoryGroup) Execute

func (o *AssembleFactoryGroup) Execute() error

type AssembleMineGroup

type AssembleMineGroup struct {
	Line      int
	Id        int        // id of unit being ordered
	DepositId string     // deposit to assemble mines at
	Quantity  int        // number of units to assemble
	Unit      units.Unit // mine units to assemble
}

func (*AssembleMineGroup) Execute

func (o *AssembleMineGroup) Execute() error

type AssembleUnit

type AssembleUnit struct {
	Line     int
	Id       int        // id of unit being ordered
	Quantity int        // number of units to assemble
	Unit     units.Unit // unit to assemble
}

func (*AssembleUnit) Execute

func (o *AssembleUnit) Execute() error

type Bombard

type Bombard struct {
	Line         int
	Id           int // id of unit being ordered
	PctCommitted int
	TargetId     int // id of unit being attacked
}

func (*Bombard) Execute

func (o *Bombard) Execute() error

type Buy

type Buy struct {
	Line     int
	Id       int        // id of unit being ordered
	Quantity int        // number of units to purchase
	Unit     units.Unit // unit to sell
	Bid      float64    // bid per unit
}

func (*Buy) Execute

func (o *Buy) Execute() error

type CheckRebels

type CheckRebels struct {
	Line     int
	Id       int // id of unit being ordered
	Quantity int // number of units to use
}

func (*CheckRebels) Execute

func (o *CheckRebels) Execute() error

type Claim

type Claim struct {
	Line     int
	Id       int                     // id of unit being ordered
	Location coordinates.Coordinates // location to be claimed
}

func (*Claim) Execute

func (o *Claim) Execute() error

type ConvertRebels

type ConvertRebels struct {
	Line     int
	Id       int // id of unit being ordered
	Quantity int // number of units to use
}

func (*ConvertRebels) Execute

func (o *ConvertRebels) Execute() error

type CounterAgents

type CounterAgents struct {
	Line     int
	Id       int // id of unit being ordered
	Quantity int // number of units to use
}

func (*CounterAgents) Execute

func (o *CounterAgents) Execute() error

type Discharge

type Discharge struct {
	Line       int
	Id         int    // id of unit being ordered
	Quantity   int    // number of units to use
	Profession string // profession to discharge from
}

func (*Discharge) Execute

func (o *Discharge) Execute() error

type Draft

type Draft struct {
	Line       int
	Id         int    // id of unit being ordered
	Quantity   int    // number of units to use
	Profession string // profession to draft into
}

func (*Draft) Execute

func (o *Draft) Execute() error

type Engine

type Engine struct {
	// Game holds information about the current game
	Game games.Game

	// Players holds every player that has ever been in this game.
	Players map[string]player.Player

	// Orders holds every player's set of orders for the current turn.
	Orders []*Orders
}

Engine holds the state of a single game

func LoadGame

func LoadGame(path string) (*Engine, error)

func (*Engine) AddOrders

func (e *Engine) AddOrders(orders []orders.Order) error

func (*Engine) Process

func (e *Engine) Process() error

func (*Engine) SaveGame

func (e *Engine) SaveGame(path string) error

func (*Engine) SecretsPhase

func (e *Engine) SecretsPhase(orders *Orders) error

type ExpandFactoryGroup

type ExpandFactoryGroup struct {
	Line         int
	Id           int        // id of unit being ordered
	FactoryGroup string     // factory group to expand
	Quantity     int        // number of units to assemble
	Unit         units.Unit // mine units to assemble
}

func (*ExpandFactoryGroup) Execute

func (o *ExpandFactoryGroup) Execute() error

type ExpandMineGroup

type ExpandMineGroup struct {
	Line      int
	Id        int        // id of unit being ordered
	MineGroup string     // mine group to expand
	Quantity  int        // number of units to assemble
	Unit      units.Unit // mine units to assemble
}

func (*ExpandMineGroup) Execute

func (o *ExpandMineGroup) Execute() error

type GameJS

type GameJS struct {
	Id      string   `json:"id,omitempty"`
	Name    string   `json:"name,omitempty"`
	Turn    int      `json:"turn,omitempty"`
	Players []string `json:"players,omitempty"`
}

type Grant

type Grant struct {
	Line     int
	Location coordinates.Coordinates // coordinates of system and orbit
	Kind     string                  // kind of grant
	TargetId int                     // nation to grant
}

func (*Grant) Execute

func (o *Grant) Execute() error

type InciteRebels

type InciteRebels struct {
	Line     int
	Id       int // id of unit being ordered
	Quantity int // number of units to use
	TargetId int // id of nation to target
}

func (*InciteRebels) Execute

func (o *InciteRebels) Execute() error

type Invade

type Invade struct {
	Line         int
	Id           int // id of unit being ordered
	PctCommitted int
	TargetId     int // id of unit being attacked
}

func (*Invade) Execute

func (o *Invade) Execute() error

type Jump

type Jump struct {
	Line     int
	Id       int                     // id of unit being ordered
	Location coordinates.Coordinates // coordinates to move to
}

func (*Jump) Execute

func (o *Jump) Execute() error

type Move

type Move struct {
	Line  int
	Id    int // id of unit being ordered
	Orbit int // orbit to move to
}

func (*Move) Execute

func (o *Move) Execute() error

type Name

type Name struct {
	Line     int
	Location coordinates.Coordinates // coordinates of system or planet to name
	Name     string                  // new name for unit
}

func (*Name) Execute

func (o *Name) Execute() error

type NameUnit

type NameUnit struct {
	Line int
	Id   int    // id of unit being ordered
	Name string // new name for unit
}

func (*NameUnit) Execute

func (o *NameUnit) Execute() error

type News

type News struct {
	Line      int
	Location  coordinates.Coordinates // location to send news to
	Article   string
	Signature string
}

func (*News) Execute

func (o *News) Execute() error

type Orders

type Orders struct {
	Validated bool
	Handle    string
	Game      string
	Turn      int
	Secret    *Secret
	Orders    []orders.Order
	Error     error
}

Orders holds all of a player's orders for a single turn.

type PayAll

type PayAll struct {
	Line       int
	Profession string  // profession to change pay for
	Rate       float64 // new pay rate
}

func (*PayAll) Execute

func (o *PayAll) Execute() error

type PayLocal

type PayLocal struct {
	Line       int
	Id         int     // id of unit being ordered
	Profession string  // profession to change pay for
	Rate       float64 // new pay rate
}

func (*PayLocal) Execute

func (o *PayLocal) Execute() error

type PlayerJS

type PlayerJS struct {
	Handle string `json:"handle,omitempty"`
	Secret string `json:"secret,omitempty"`
	Nation string `json:"nation,omitempty"`
}

type Probe

type Probe struct {
	Line  int
	Id    int // id of unit being ordered
	Orbit int // orbit to probe
}

func (*Probe) Execute

func (o *Probe) Execute() error

type ProbeSystem

type ProbeSystem struct {
	Line     int
	Id       int                     // id of unit being ordered
	Location coordinates.Coordinates // location to probe
}

func (*ProbeSystem) Execute

func (o *ProbeSystem) Execute() error

type Raid

type Raid struct {
	Line         int
	Id           int // id of unit being ordered
	PctCommitted int
	TargetId     int        // id of unit being raided
	TargetUnit   units.Unit // material to raid
}

func (*Raid) Execute

func (o *Raid) Execute() error

type RationAll

type RationAll struct {
	Line int
	Rate int // new ration percentage
}

func (*RationAll) Execute

func (o *RationAll) Execute() error

type RationLocal

type RationLocal struct {
	Line int
	Id   int // id of unit being ordered
	Rate int // new ration percentage
}

func (*RationLocal) Execute

func (o *RationLocal) Execute() error

type RecycleFactoryGroup

type RecycleFactoryGroup struct {
	Line         int
	Id           int        // id of unit being ordered
	FactoryGroup string     // factory group to recycle units from
	Quantity     int        // number of units to recycle
	Unit         units.Unit // unit to recycle
}

func (*RecycleFactoryGroup) Execute

func (o *RecycleFactoryGroup) Execute() error

type RecycleMineGroup

type RecycleMineGroup struct {
	Line      int
	Id        int        // id of unit being ordered
	MineGroup string     // mine group to recycle units from
	Quantity  int        // number of units to recycle
	Unit      units.Unit // unit to recycle
}

func (*RecycleMineGroup) Execute

func (o *RecycleMineGroup) Execute() error

type RecycleUnit

type RecycleUnit struct {
	Line     int
	Id       int        // id of unit being ordered
	Quantity int        // number of units to recycle
	Unit     units.Unit // unit to recycle
}

func (*RecycleUnit) Execute

func (o *RecycleUnit) Execute() error

type RetoolFactoryGroup

type RetoolFactoryGroup struct {
	Line         int
	Id           int        // id of unit being ordered
	FactoryGroup string     // factory group to retool
	Unit         units.Unit // new unit to manufacture
}

func (*RetoolFactoryGroup) Execute

func (o *RetoolFactoryGroup) Execute() error

type Revoke

type Revoke struct {
	Line     int
	Location coordinates.Coordinates // coordinates of system and orbit
	Kind     string                  // kind of grant
	TargetId int                     // nation to grant
}

func (*Revoke) Execute

func (o *Revoke) Execute() error

type ScrapFactoryGroup

type ScrapFactoryGroup struct {
	Line         int
	Id           int        // id of unit being ordered
	FactoryGroup string     // factory group to scrap units from
	Quantity     int        // number of units to scrap
	Unit         units.Unit // unit to scrap
}

func (*ScrapFactoryGroup) Execute

func (o *ScrapFactoryGroup) Execute() error

type ScrapMineGroup

type ScrapMineGroup struct {
	Line      int
	Id        int        // id of unit being ordered
	MineGroup string     // mine group to scrap units from
	Quantity  int        // number of units to scrap
	Unit      units.Unit // unit to scrap
}

func (*ScrapMineGroup) Execute

func (o *ScrapMineGroup) Execute() error

type ScrapUnit

type ScrapUnit struct {
	Line     int
	Id       int        // id of unit being ordered
	Quantity int        // number of units to scrap
	Unit     units.Unit // unit to scrap
}

func (*ScrapUnit) Execute

func (o *ScrapUnit) Execute() error

type Secret

type Secret struct {
	Line   int
	Handle string
	Game   string
	Turn   int
	Token  string
}

func (*Secret) Execute

func (o *Secret) Execute() error

type Sell

type Sell struct {
	Line     int
	Id       int        // id of unit being ordered
	Quantity int        // number of units to sell
	Unit     units.Unit // unit to sell
	Ask      float64    // ask per unit
}

func (*Sell) Execute

func (o *Sell) Execute() error

type Setup

type Setup struct {
	Line     int
	Id       int                     // id of unit establishing ship or colony
	Location coordinates.Coordinates // location being set up
	Kind     string                  // must be 'colony' or 'ship'
	Action   string                  // must be 'transfer'
	Items    []*orders.TransferDetail
}

func (*Setup) Execute

func (o *Setup) Execute() error

type StealSecrets

type StealSecrets struct {
	Line     int
	Id       int // id of unit being ordered
	Quantity int // number of units to use
	TargetId int // id of nation to target
}

func (*StealSecrets) Execute

func (o *StealSecrets) Execute() error

type StoreFactoryGroup

type StoreFactoryGroup struct {
	Line         int
	Id           int        // id of unit being ordered
	FactoryGroup string     // factory group to store units from
	Quantity     int        // number of units to store
	Unit         units.Unit // unit to store
}

func (*StoreFactoryGroup) Execute

func (o *StoreFactoryGroup) Execute() error

type StoreMineGroup

type StoreMineGroup struct {
	Line      int
	Id        int        // id of unit being ordered
	MineGroup string     // mine group to store units from
	Quantity  int        // number of units to store
	Unit      units.Unit // unit to store
}

func (*StoreMineGroup) Execute

func (o *StoreMineGroup) Execute() error

type StoreUnit

type StoreUnit struct {
	Line     int
	Id       int        // id of unit being ordered
	Quantity int        // number of units to store
	Unit     units.Unit // unit to store
}

func (*StoreUnit) Execute

func (o *StoreUnit) Execute() error

type SupportAttack

type SupportAttack struct {
	Line         int
	Id           int // id of unit being ordered
	PctCommitted int
	SupportId    int // id of unit being supported
	TargetId     int // id of unit being attacked
}

func (*SupportAttack) Execute

func (o *SupportAttack) Execute() error

type SupportDefend

type SupportDefend struct {
	Line         int
	Id           int // id of unit being ordered
	SupportId    int // id of unit being supported
	PctCommitted int
}

func (*SupportDefend) Execute

func (o *SupportDefend) Execute() error

type SuppressAgents

type SuppressAgents struct {
	Line     int
	Id       int // id of unit being ordered
	Quantity int // number of units to use
	TargetId int // id of nation to target
}

func (*SuppressAgents) Execute

func (o *SuppressAgents) Execute() error

type Survey

type Survey struct {
	Line  int
	Id    int // id of unit being ordered
	Orbit int // orbit to survey
}

func (*Survey) Execute

func (o *Survey) Execute() error

type SurveySystem

type SurveySystem struct {
	Line     int
	Id       int                     // id of unit being ordered
	Location coordinates.Coordinates // location to survey
}

func (*SurveySystem) Execute

func (o *SurveySystem) Execute() error

type Transfer

type Transfer struct {
	Line     int
	Id       int        // id of unit being ordered
	Quantity int        // number of units to transfer
	Unit     units.Unit // unit to transfer
	TargetId int        // id of unit receiving units
}

func (*Transfer) Execute

func (o *Transfer) Execute() error

type Unknown

type Unknown struct {
	Line    int
	Command string
}

The Unknown order type captures unrecognized orders.

func (*Unknown) Execute

func (o *Unknown) Execute() error

Jump to

Keyboard shortcuts

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