Miner

class games.coreminer.miner.Miner

Bases: games.coreminer.game_object.GameObject

The class representing the Miner in the Coreminer game.

A Miner in the game.

property bombs

The number of bombs being carried by this Miner.

Type

int

build(tile: games.coreminer.tile.Tile, type: str) → bool

Builds a support, shield, or ladder on Miner’s Tile, or an adjacent Tile.

Parameters
  • tile (games.coreminer.tile.Tile) – The Tile to build on.

  • type ('support', 'ladder', or 'shield') – The structure to build (support, ladder, or shield).

Returns

True if successfully built, False otherwise.

Return type

bool

property building_materials

The number of building materials carried by this Miner.

Type

int

buy(resource: str, amount: int) → bool

Purchase a resource from the Player’s base or hopper.

Parameters
  • resource ('dirt', 'ore', 'bomb', or 'buildingMaterials') – The type of resource to buy.

  • amount (int) – The amount of resource to buy. Amounts <= 0 will buy all of that material Player can.

Returns

True if successfully purchased, False otherwise.

Return type

bool

property current_upgrade

The Upgrade this Miner is on.

Type

games.coreminer.upgrade.Upgrade

property dirt

The amount of dirt carried by this Miner.

Type

int

dump(tile: games.coreminer.tile.Tile, material: str, amount: int) → bool

Dumps materials from cargo to an adjacent Tile. If the Tile is a base or a hopper Tile, materials are sold instead of placed.

Parameters
  • tile (games.coreminer.tile.Tile) – The Tile the materials will be dumped on.

  • material ('dirt', 'ore', or 'bomb') – The material the Miner will drop. ‘dirt’, ‘ore’, or ‘bomb’.

  • amount (int) – The number of materials to drop. Amounts <= 0 will drop all of the material.

Returns

True if successfully dumped materials, False otherwise.

Return type

bool

property game_object_name

String representing the top level Class that this game object is an instance of. Used for reflection to create new instances on clients, but exposed for convenience should AIs want this data.

Type

str

property health

The remaining health of this Miner.

Type

int

property id

A unique id for each instance of a GameObject or a sub class. Used for client and server communication. Should never change value after being set.

Type

str

log(message: str) → None

Adds a message to this GameObject’s logs. Intended for your own debugging purposes, as strings stored here are saved in the gamelog.

Parameters

message (str) – A string to add to this GameObject’s log. Intended for debugging.

property logs

Any strings logged will be stored here. Intended for debugging.

Type

list[str]

mine(tile: games.coreminer.tile.Tile, amount: int) → bool

Mines the Tile the Miner is on or an adjacent Tile.

Parameters
  • tile (games.coreminer.tile.Tile) – The Tile the materials will be mined from.

  • amount (int) – The amount of material to mine up. Amounts <= 0 will mine all the materials that the Miner can.

Returns

True if successfully mined, False otherwise.

Return type

bool

property mining_power

The remaining mining power this Miner has this turn.

Type

int

move(tile: games.coreminer.tile.Tile) → bool

Moves this Miner from its current Tile to an adjacent Tile.

Parameters

tile (games.coreminer.tile.Tile) – The Tile this Miner should move to.

Returns

True if it moved, False otherwise.

Return type

bool

property moves

The number of moves this Miner has left this turn.

Type

int

property ore

The amount of ore carried by this Miner.

Type

int

property owner

The Player that owns and can control this Miner.

Type

games.coreminer.player.Player

property tile

The Tile this Miner is on.

Type

games.coreminer.tile.Tile or None

transfer(miner: games.coreminer.miner.Miner, resource: str, amount: int) → bool

Transfers a resource from the one Miner to another.

Parameters
  • miner (games.coreminer.miner.Miner) – The Miner to transfer materials to.

  • resource ('dirt', 'ore', 'bomb', or 'buildingMaterials') – The type of resource to transfer.

  • amount (int) – The amount of resource to transfer. Amounts <= 0 will transfer all the of the material.

Returns

True if successfully transferred, False otherwise.

Return type

bool

upgrade() → bool

Upgrade this Miner by installing an upgrade module.

Returns

True if successfully upgraded, False otherwise.

Return type

bool

property upgrade_level

The upgrade level of this Miner. Starts at 0.

Type

int