Tile

class games.stumped.tile.Tile

Bases: games.stumped.game_object.GameObject

The class representing the Tile in the Stumped game.

A Tile in the game that makes up the 2D map grid.

property beaver

The Beaver on this Tile if present, otherwise None.

Type

games.stumped.beaver.Beaver or None

property branches

The number of branches dropped on this Tile.

Type

int

directions = ['North', 'East', 'South', 'West']

The valid directions that tiles can be in, “North”, “East”, “South”, or “West”

Type

int

property flow_direction

The cardinal direction water is flowing on this Tile (‘North’, ‘East’, ‘South’, ‘West’).

Type

‘North’, ‘East’, ‘South’, ‘West’, or ‘’

property food

The number of food dropped on this Tile.

Type

int

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

get_neighbors() → List[games.stumped.tile.Tile]

Gets the neighbors of this Tile

Returns

The list of neighboring Tiles of this Tile.

Return type

list[games.stumped.tile.Tile]

has_neighbor(tile: games.stumped.tile.Tile) → bool

Checks if this Tile has a specific neighboring Tile.

Parameters

tile (games.stumped.tile.Tile) – The Tile to check against.

Returns

True if the tile is a neighbor of this Tile, False otherwise

Return type

bool

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

is_pathable() → bool

Checks if a Tile is pathable to units

Returns

True if pathable, False otherwise.

Return type

bool

property lodge_owner

The owner of the Beaver lodge on this Tile, if present, otherwise None.

Type

games.stumped.player.Player or None

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]

property spawner

The resource Spawner on this Tile if present, otherwise None.

Type

games.stumped.spawner.Spawner or None

property tile_east

The Tile to the ‘East’ of this one (x+1, y). None if out of bounds of the map.

Type

games.stumped.tile.Tile or None

property tile_north

The Tile to the ‘North’ of this one (x, y-1). None if out of bounds of the map.

Type

games.stumped.tile.Tile or None

property tile_south

The Tile to the ‘South’ of this one (x, y+1). None if out of bounds of the map.

Type

games.stumped.tile.Tile or None

property tile_west

The Tile to the ‘West’ of this one (x-1, y). None if out of bounds of the map.

Type

games.stumped.tile.Tile or None

property type

What type of Tile this is, either ‘water’ or ‘land’.

Type

‘land’ or ‘water’

property x

The x (horizontal) position of this Tile.

Type

int

property y

The y (vertical) position of this Tile.

Type

int