GameTheory.jl icon indicating copy to clipboard operation
GameTheory.jl copied to clipboard

Sample games

Open oyamad opened this issue 8 years ago • 8 comments

It will be helpful to implement a list of sample games, such as

function prisoners_dilemma(;gain::Real=2, loss::Real=2)
    gain <= 0 && throw(ArgumentError("gain must be positive"))
    loss <= 0 && throw(ArgumentError("loss must be positive"))

    payoff_matrix = [1 -loss;
                     1+gain 0]
    return NormalFormGame(payoff_matrix)
end

(This is just one possible, but seemingly popular, way to normalize the payoffs of Prisoners' Dilemma.)

oyamad avatar Mar 16 '16 15:03 oyamad

Perhaps we could put them in a Games.Examples module users could load if they wanted them?

so this wouldn't work:

using Games
pdg = prisoners_dilemma()

but this would

using Games, Games.Examples
pdg = prisoners_dilemma()

sglyon avatar Mar 17 '16 14:03 sglyon

Fine with me.

oyamad avatar Mar 17 '16 14:03 oyamad

@oyamad Any news on this issue?

QBatista avatar Sep 18 '17 21:09 QBatista

Candidates for the name of the module:

  1. Games.Examples
  2. Games.Samples
  3. Games.Generators

Any thoughts?

oyamad avatar Sep 24 '17 14:09 oyamad

Vote for Games.Generators as it allows users to choose different input, rather than just offers different kinds of games with unchangeable payoff matrices.

shizejin avatar Sep 24 '17 15:09 shizejin

I like both Games.Examples and Games.Generators

I think Games.Examples feels a little more intuitive, but that is likely just personal preference.

cc7768 avatar Sep 24 '17 15:09 cc7768

I prefer Games.Generators the most - I think Games.Examples and Game.Samples don't necessarily suggest that users have some discretion in choosing payoffs

QBatista avatar Sep 24 '17 20:09 QBatista

For bimatrix_generators see #53.

oyamad avatar Sep 26 '17 12:09 oyamad