egttools.numerical.structure.factories.AbstractSpatialGame

class AbstractSpatialGame(self: egttools.numerical.numerical_.games.AbstractSpatialGame)

Bases: pybind11_object

Abstract base class for spatially structured games.

This interface supports general spatial interaction models, where the fitness of a strategy is computed based on a local context (e.g., neighborhood composition).

This is typically used in network-based or spatial grid environments.

Note

This interface is still under active development and may change in future versions.

Methods

calculate_fitness

Calculates the fitness of a strategy in a local interaction context.

nb_strategies

Returns the number of strategies in the spatial game.

type

Identifier for the type of spatial game.

__init__(self: egttools.numerical.numerical_.games.AbstractSpatialGame) None

Abstract base class for spatially structured games.

This interface supports general spatial interaction models, where the fitness of a strategy is computed based on a local context (e.g., neighborhood composition).

This is typically used in network-based or spatial grid environments.

Note

This interface is still under active development and may change in future versions.

__new__(**kwargs)
__str__(self: egttools.numerical.numerical_.games.AbstractSpatialGame) str

String representation of the spatial game.

calculate_fitness(self: egttools.numerical.numerical_.games.AbstractSpatialGame, strategy_index: int, state: numpy.ndarray[numpy.uint64[m, 1]]) float

Calculates the fitness of a strategy in a local interaction context.

Parameters:
  • strategy_index (int) – The strategy of the focal player.

  • state (numpy.ndarray[int]) – Vector representing the local configuration (e.g., neighbor counts).

Returns:

The computed fitness of the strategy in the given local state.

Return type:

float

nb_strategies(self: egttools.numerical.numerical_.games.AbstractSpatialGame) int

Returns the number of strategies in the spatial game.

type(self: egttools.numerical.numerical_.games.AbstractSpatialGame) str

Identifier for the type of spatial game.

__annotations__ = {}