egttools.games.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.

Methods

calculate_fitness

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

nb_strategies

type

__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.

__new__(**kwargs)
__str__(self: egttools.numerical.numerical_.games.AbstractSpatialGame) str
calculate_fitness(self: egttools.numerical.numerical_.games.AbstractSpatialGame, strategy_index: SupportsInt | SupportsIndex, state: Annotated[numpy.typing.ArrayLike, 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) – Vector representing the local configuration.

Returns:

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

Return type:

float

nb_strategies(self: egttools.numerical.numerical_.games.AbstractSpatialGame) int
type(self: egttools.numerical.numerical_.games.AbstractSpatialGame) str
__annotations__ = {}