The package provides descriptions and data of different games amenable for Game Theory experiments and studies.
From Zef ecosystem:
zef install Math::GameTheory
From GitHub:
zef install https://github.com/antononcube/Raku-Math-GameTheory
All games known by the package "Math::GameTheory":
use Math::GameTheory;
say "Total number of known games: {game-theory-data().elems}";
say game-theory-data();Games and their classes:
my @dsGames = game-theory-data(Whatever, property => "Classes").map({ $_.key X $_.value.Array }).flat(1).map({ <name property> Z=> $_ })».Hash;
@dsGames.elemsHere is a summary:
use Data::Summarizers;
sink records-summary(@dsGames)Here is a "taxonomy tree" like breakdown:
use ML::TriesWithFrequencies;
my %cat = <2Player 3Player NPlayer MatrixGame TreeGame Symmetric> Z=> (^7);
game-theory-data(Whatever, property => "Classes").values
==> { .map({ %cat.keys (&) $_ }) }()
==> { $_.map({ $_ ?? $_.keys !! 'Other' })».sort({ %cat{$_} })».List }()
==> trie-create()
==> trie-form()Here is a property vs. game cross tabulation:
use Data::Reshapers;
use Data::Translators;
cross-tabulate(@dsGames, 'property', 'name')
==> { $_.map({ %( property => $_.key, |$_.value) }).sort(*<property>).List }()
==> to-dataset()
==> to-html(field-names => ['property', |game-theory-data()], :vertical-header-names)
==> { .subst('1', '⏺', :g) }()
==> { .subst(/ ['<th' .+? '>' property '</th>'] /, '<th>property</th>') }()Get the game "Chicken" (provided by the package):
my $obj = game-theory-data('Chicken')Here is a description of the game:
$obj.descriptionHere is game's table:
$obj.htmlHere is a gray-scale version of the dataset can be obtained with $obj.html(theme => 'gray-scale').
Get the game "3Coordination" (provided by the package):
my $obj = game-theory-data('3Coordination')$obj.descriptionHere is game's table:
$obj.htmlRepresent a Rock Paper Scissors game as a directed graph:
use Graph;
my $g = Graph.new(edges => [Rock => "Scissors", Scissors => "Paper", Paper => "Rock"]):d;
#$g.dot(engine => 'neato', :2size, vertex-font-size => 8):svgCreate a Rock Paper Scissors game:
use Data::Reshapers;
my @payoff-array = ($g.adjacency-matrix <<->> transpose($g.adjacency-matrix)).deepmap(-> Int:D $p { [$p, -$p] });
my $game = Math::GameTheory::MatrixGame.new(:@payoff-array, game-action-labels => ($g.vertex-list xx 2))Here is game's table:
$game.html(theme => 'default')- TODO Implementation
- TODO Retrieval and creation of games
- DONE Games data JSON file and corresponding retrieval (multi-)sub
- TODO Retrieving games using regexes
- TODO Using properties with any case
- TODO Matrix games
- DONE
MatrixGameclass - DONE HTML format of matrix game dataset
- DONE Wolfram Language (WL) representation
- TODO Payoff functions
- TODO Expectation
- TODO MarginalDistribution
- TODO MultivariateDistribution
- TODO Variance
- TODO Simulation
- TODO Simpler zero-sum games initialization
- DONE
- TODO Tree games
- TODO
TreeGameclass - TODO Creation using WL's tree game input format
- TODO Special tree-game plots
- TODO
- TODO Retrieval and creation of games
- TODO Documentation
- DONE Complete README
- TODO Basic usage notebook
- TODO Blog post
- TODO Video demo