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::GameTheory

From GitHub:

zef install https://github.com/antononcube/Raku-Math-GameTheory

Game 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.elems

Here 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.description

Here is game's table:

$obj.html

Here 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.description

Here is game's table:

$obj.html

Zero 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):svg

image 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 MatrixGame class

      • DONE HTML format of matrix game dataset

      • DONE Wolfram Language (WL) representation

      • TODO Payoff functions

      • TODO Simpler zero-sum games initialization

    • TODO Tree games

      • TODO TreeGame class

      • TODO 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

Math::GameTheory v0.0.1

Facilitation of Game theory models, experiments, and studies.

Authors

  • Anton Antonov

License

MIT

Dependencies

JSON::Fast:ver<0.19+>Statistics::Distributions:ver<0.1.7>

Test Dependencies

Provides

  • Math::GameTheory
  • Math::GameTheory::Creators
  • Math::GameTheory::MatrixGame
  • Math::GameTheory::MatrixGame::Formatish

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.