README-work
Math::GameTheory
The package provides descriptions and data of different games amenable for Game Theory experiments and studies.
Installation
From Zef ecosystem:
zef install Math::GameTheoryFrom GitHub:
zef install https://github.com/antononcube/Raku-Math-GameTheoryGame Theory data
All games known by the package "Math::GameTheory":
use Math::GameTheory;
say "Total number of known games: {game-theory-data().elems}";
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()Two player games
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').
Three player games
Get the game "3Coordination" (provided by the package):
my $obj = game-theory-data('3Coordination')$obj.descriptionHere is game's table:
$obj.htmlZero sum games
Represent 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):svgimage izef_math_gametheory_dist_docs_img_rock_paper_scissors_graph_svg not found
Create 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
TODO Implementation
DONE Games data JSON file and corresponding retrieval (multi-)sub
TODO Matrix games
DONE
MatrixGameclassDONE HTML format of matrix game dataset
DONE Wolfram Language (WL) representation
TODO Payoff functions
TODO Simpler zero-sum games initialization
TODO Tree games
TODO
TreeGameclassTODO Creation using WL's tree game input format
TODO Special tree-game plots
TODO Documentation
DONE Complete README
TODO Basic usage notebook
TODO Blog post
TODO Video demo