Rock, Paper, Scissors

Ver. 1.0.1 (2024-01-12)

This module provides a duel of two coalitions of a game of Rock Paper Scissors with random solver. In the near future, we are going to add more solvers and this howto is going to be updated accordingly.

The game consists of two coaltions, where each coalition makes a decision based on the colllaborative approach between the coalitions. Each coalition consists of 5 members, the most voted decision of the 5 members represents the final decision of the coalition.

To be noted, the decision making of the coalitions take place simultaneously, where: - Decision “0” means Rock - Decision “1” means Paper - Decision “2” means Scissors

class mlpro.gt.pool.native.games.rockpaperscissors.PayoffFunction_RSP(p_func_type: int, p_dim_elems: list = None, p_num_coalisions: int = None, p_logging=True)

Bases: GTFunction

_setup_mapping_matrix() ndarray

A method to setup the mapping of the payoff matrix between strategies and payoffs. This is only applicable for C_FUNC_PAYOFF_MATRIX. This method needs to be redefined based on the setup of the game.

Returns:

Resulted mapping.

Return type:

np.ndarray

_setup_payoff_matrix()

A method to setup payoff matrices. This is only applicable for C_FUNC_PAYOFF_MATRIX. This method needs to be redefined based on the setup of the game.

class mlpro.gt.pool.native.games.rockpaperscissors.RockPaperScissors(p_mode=0, p_ada=False, p_cycle_limit=1, p_visualize: bool = False, p_logging=True)

Bases: GTGame

C_NAME = 'RockPaperScissors'
_setup(p_mode, p_ada: bool, p_visualize: bool, p_logging) Model

Custom setup of GT Game. Payoff matrix has to be defined here as self._payoff.

Parameters:
  • p_mode – Operation mode. See Mode.C_VALID_MODES for valid values. Default = Mode.C_MODE_SIM

  • p_ada (bool) – Boolean switch for adaptivity.

  • p_visualize (bool) – Boolean switch for visualisation.

  • p_logging – Log level (see constants of class Log).

Returns:

player – GTPlayer model (object of type GTPlayer, GTCoalition or GTCompetition).

Return type:

GTPlayer