TileDirections are all the direction strings that Tile's neighbors can be in.
var TileDirections = [...]string{"North", "South", "East", "West"}
func PlayerName() string
PlayerName should return the string name of your Player in games it plays.
AI is your personal AI implimentation.
type AI struct {
base.AIImpl
}
func (ai *AI) Ended(won bool, reason string)
Ended is called when the game ends, you can clean up your data and dump files here if need be.
func (ai *AI) Game() Game
Game returns the instance of the Game this AI is currently playing.
func (ai *AI) GameUpdated()
GameUpdated is called every time the game's state updates, so if you are tracking anything you can update it here.
func (ai *AI) Player() Player
Player returns the instance of the Player this AI is represented by in the game this AI is playing.
func (ai *AI) RunTurn() bool
RunTurn this is called every time it is this AI.player's turn.
func (ai *AI) Start()
Start is called once the game starts and your AI has a Player and Game. You can initialize your AI struct here.
Game is combine elements and be the first scientists to create fusion.
type Game interface {
// Parent interfaces
base.Game
// CurrentPlayer is the player whose turn it is currently. That
// player can send commands. Other players cannot.
CurrentPlayer() Player
// CurrentTurn is the current turn number, starting at 0 for the
// first player's turn.
CurrentTurn() int64
// GameObjects is a mapping of every game object's ID to the
// actual game object. Primarily used by the server and client to
// easily refer to the game objects via ID.
GameObjects() map[string]GameObject
// InternCap is the maximum number of interns a player can have.
InternCap() int64
// Jobs is an array of all jobs. The first element is intern,
// second is physicists, and third is manager.
Jobs() []Job
// Machines is every Machine in the game.
Machines() []Machine
// ManagerCap is the maximum number of managers a player can have.
ManagerCap() int64
// MapHeight is the number of Tiles in the map along the y
// (vertical) axis.
MapHeight() int64
// MapWidth is the number of Tiles in the map along the x
// (horizontal) axis.
MapWidth() int64
// MaterialSpawn is the number of materials that spawn per spawn
// cycle.
MaterialSpawn() int64
// MaxTurns is the maximum number of turns before the game will
// automatically end.
MaxTurns() int64
// PhysicistCap is the maximum number of physicists a player can
// have.
PhysicistCap() int64
// Players is array of all the players in the game.
Players() []Player
// RefinedValue is the amount of victory points added when a
// refined ore is consumed by the generator.
RefinedValue() int64
// RegenerateRate is the percent of max HP regained when a unit
// end their turn on a tile owned by their player.
RegenerateRate() float64
// Session is a unique identifier for the game instance that is
// being played.
Session() string
// SpawnTime is the amount of turns it takes a unit to spawn.
SpawnTime() int64
// StunTime is the amount of turns a unit cannot do anything when
// stunned.
StunTime() int64
// Tiles is all the tiles in the map, stored in Row-major order.
// Use `x + y * mapWidth` to access the correct index.
Tiles() []Tile
// TimeAddedPerTurn is the amount of time (in nano-seconds) added
// after each player performs a turn.
TimeAddedPerTurn() float64
// TimeImmune is the number turns a unit is immune to being
// stunned.
TimeImmune() int64
// Units is every Unit in the game.
Units() []Unit
// VictoryAmount is the amount of combined heat and pressure that
// you need to win.
VictoryAmount() int64
// GetTileAt returns the Tile at a give position (x, y).
GetTileAt(int64, int64) Tile
}
GameObject is an object in the game. The most basic class that all game classes should inherit from automatically.
type GameObject interface {
// Parent interfaces
base.GameObject
// Logs is any strings logged will be stored here. Intended for
// debugging.
Logs() []string
// Log adds a message to this GameObject's logs. Intended for your
// own debugging purposes, as strings stored here are saved in the
// gamelog.
Log(string)
}
Job is information about a unit's job.
type Job interface {
// Parent interfaces
GameObject
// CarryLimit is how many combined resources a unit with this Job
// can hold at once.
CarryLimit() int64
// Damage is the amount of damage this Job does per attack.
Damage() int64
// Health is the amount of starting health this Job has.
Health() int64
// Moves is the number of moves this Job can make per turn.
Moves() int64
// Title is the Job title. 'intern', 'manager', or 'physicist'.
//
// Literal Values: "intern", "manager", or "physicist"
Title() string
}
Machine is a machine in the game. Used to refine ore.
type Machine interface {
// Parent interfaces
GameObject
// OreType is what type of ore the machine takes it. Also
// determines the type of material it outputs. (redium or
// blueium).
//
// Literal Values: "redium" or "blueium"
OreType() string
// RefineInput is the amount of ore that needs to be inputted into
// the machine for it to be worked.
RefineInput() int64
// RefineOutput is the amount of refined ore that is returned
// after the machine has been fully worked.
RefineOutput() int64
// RefineTime is the number of times this machine needs to be
// worked to refine ore.
RefineTime() int64
// Tile is the Tile this Machine is on.
Tile() Tile
// Worked is tracks how many times this machine has been worked.
// (0 to refineTime).
Worked() int64
}
Player is a player in this game. Every AI controls one player.
type Player interface {
// Parent interfaces
GameObject
// ClientType is what type of client this is, e.g. 'Python',
// 'JavaScript', or some other language. For potential data mining
// purposes.
ClientType() string
// GeneratorTiles is every generator Tile owned by this Player.
// (arrayed from the outer edges inward, from top to bottom).
GeneratorTiles() []Tile
// Heat is the amount of heat this Player has.
Heat() int64
// InternSpawn is the time left till a intern spawns. (0 to
// spawnTime).
InternSpawn() int64
// Lost is if the player lost the game or not.
Lost() bool
// ManagerSpawn is the time left till a manager spawns. (0 to
// spawnTime).
ManagerSpawn() int64
// Name is the name of the player.
Name() string
// Opponent is this player's opponent in the game.
Opponent() Player
// PhysicistSpawn is the time left till a physicist spawns. (0 to
// spawnTime).
PhysicistSpawn() int64
// Pressure is the amount of pressure this Player has.
Pressure() int64
// ReasonLost is the reason why the player lost the game.
ReasonLost() string
// ReasonWon is the reason why the player won the game.
ReasonWon() string
// SpawnTiles is all the tiles this Player's units can spawn on.
// (arrayed from the outer edges inward, from top to bottom).
SpawnTiles() []Tile
// TimeRemaining is the amount of time (in ns) remaining for this
// AI to send commands.
TimeRemaining() float64
// Units is every Unit owned by this Player.
Units() []Unit
// Won is if the player won the game or not.
Won() bool
}
Tile is a Tile in the game that makes up the 2D map grid.
type Tile interface {
// Parent interfaces
GameObject
// Blueium is the amount of blueium on this tile.
Blueium() int64
// BlueiumOre is the amount of blueium ore on this tile.
BlueiumOre() int64
// Decoration is (Visualizer only) Different tile types, cracked,
// slightly dirty, etc. This has no effect on gameplay, but feel
// free to use it if you want.
Decoration() int64
// Direction is the direction of a conveyor belt ('blank',
// 'north', 'east', 'south', or 'west'). Blank means conveyor
// doesn't move.
//
// Literal Values: "blank", "north", "east", "south", or "west"
Direction() string
// IsWall is whether or not the tile is a wall.
IsWall() bool
// Machine is the Machine on this Tile if present, otherwise nil.
//
// Value can be returned as a nil pointer.
Machine() Machine
// Owner is the owner of this Tile, or nil if owned by no-one.
// Only for generators and spawn areas.
//
// Value can be returned as a nil pointer.
Owner() Player
// Redium is the amount of redium on this tile.
Redium() int64
// RediumOre is the amount of redium ore on this tile.
RediumOre() int64
// TileEast is the Tile to the 'East' of this one (x+1, y). Nil if
// out of bounds of the map.
//
// Value can be returned as a nil pointer.
TileEast() Tile
// TileNorth is the Tile to the 'North' of this one (x, y-1). Nil
// if out of bounds of the map.
//
// Value can be returned as a nil pointer.
TileNorth() Tile
// TileSouth is the Tile to the 'South' of this one (x, y+1). Nil
// if out of bounds of the map.
//
// Value can be returned as a nil pointer.
TileSouth() Tile
// TileWest is the Tile to the 'West' of this one (x-1, y). Nil if
// out of bounds of the map.
//
// Value can be returned as a nil pointer.
TileWest() Tile
// Type is the type of Tile this is ('normal', 'generator',
// 'conveyor', or 'spawn').
//
// Literal Values: "normal", "generator", "conveyor", or "spawn"
Type() string
// Unit is the Unit on this Tile if present, otherwise nil.
//
// Value can be returned as a nil pointer.
Unit() Unit
// X is the x (horizontal) position of this Tile.
X() int64
// Y is the y (vertical) position of this Tile.
Y() int64
// GetNeighbors returns an array of the neighbors of this Tile.
GetNeighbors() []Tile
// IsPathable returns if the Tile is pathable for FindPath
IsPathable() bool
// HasNeighbor checks if this Tile has a specific neighboring Tile.
HasNeighbor(Tile) bool
}
Unit is a unit in the game. May be a manager, intern, or physicist.
type Unit interface {
// Parent interfaces
GameObject
// Acted is whether or not this Unit has performed its action this
// turn.
Acted() bool
// Blueium is the amount of blueium carried by this unit. (0 to
// job carry capacity - other carried items).
Blueium() int64
// BlueiumOre is the amount of blueium ore carried by this unit.
// (0 to job carry capacity - other carried items).
BlueiumOre() int64
// Health is the remaining health of a unit.
Health() int64
// Job is the Job this Unit has.
Job() Job
// Moves is the number of moves this unit has left this turn.
Moves() int64
// Owner is the Player that owns and can control this Unit.
//
// Value can be returned as a nil pointer.
Owner() Player
// Redium is the amount of redium carried by this unit. (0 to job
// carry capacity - other carried items).
Redium() int64
// RediumOre is the amount of redium ore carried by this unit. (0
// to job carry capacity - other carried items).
RediumOre() int64
// StunImmune is duration of stun immunity. (0 to timeImmune).
StunImmune() int64
// StunTime is duration the unit is stunned. (0 to the game
// constant stunTime).
StunTime() int64
// Tile is the Tile this Unit is on.
//
// Value can be returned as a nil pointer.
Tile() Tile
// Act makes the unit do something to a machine or unit adjacent
// to its tile. Interns sabotage, physicists work. Interns stun
// physicist, physicist stuns manager, manager stuns intern.
Act(Tile) bool
// Attack attacks a unit on an adjacent tile.
Attack(Tile) bool
// Drop drops materials at the units feet or adjacent tile.
Drop(Tile, int64, string) bool
// Move moves this Unit from its current Tile to an adjacent Tile.
Move(Tile) bool
// Pickup picks up material at the units feet or adjacent tile.
Pickup(Tile, int64, string) bool
}