Rock Paper Scissor¶
A collection of 2-player rock paper scissor games.
- This includes:
A Standard Rock Paper Scissor class.
An Asymmetric Rock Paper Scissor class.
- class imperfecto.games.rock_paper_scissor.ROCK_PAPER_SCISSOR_ACTIONS(value)[source]¶
Bases:
imperfecto.misc.utils.lessVerboseEnum
,enum.IntEnum
Available actions for the rock-paper-scissors game.
- ROCK = 0¶
- PAPER = 1¶
- SCISSOR = 2¶
- class imperfecto.games.rock_paper_scissor.RockPaperScissorGame(players)[source]¶
Bases:
imperfecto.games.game.NormalFormGame
A (standard) 2-player rock-paper-scissor (extensive-form) game.
- Payoff:
Rock beats scissors, scissors beats paper, and paper beats rock. Winner gets +1 payoff, loser gets -1 payoff.
- Nash Equilibrium:
The nash strategy (unexploitable) is (1/3, 1/3, 1/3) (payoff = 0 for all)
- actions¶
alias of
imperfecto.games.rock_paper_scissor.ROCK_PAPER_SCISSOR_ACTIONS
- class imperfecto.games.rock_paper_scissor.AsymmetricRockPaperScissorGame(players)[source]¶
Bases:
imperfecto.games.rock_paper_scissor.RockPaperScissorGame
An asymmetric 2-player rock-paper-scissors (extensive-form) game.
- Payoff:
Rock beats scissors, scissors beats paper, and paper beats rock. But winner gets +2 payoff, loser gets -2 payoff when someone plays scissor. Otherwise, winner gets +1 payoff, loser gets -1 payoff.
- Nash Equilibrium:
The Nash strategy (unexploitable) is (0.4, 0.4, 0.2) (payoff = 0 for all)
- get_payoffs(history)[source]¶
Override the get_payoffs function of standard rock-paper-scissors.
The winner gets +2 payoff, loser gets -2 payoff when someone plays scissor. Otherwise, winner gets +1 payoff, loser gets -1 payoff.
- Parameters
history (
Sequence
[ROCK_PAPER_SCISSOR_ACTIONS
]) – The history of the game.- Return type
- Returns
The payoffs of the players.