- separates the definition of games from the solution method
- enforces factorization of policies into goal predicates and world models
- allows computing the policies for all players simultaneously
- Install cosh.
- Check out board:
git clone git://github.com/stuhlmueller/board.git
- Add the board directory to your
This is an example of how to use board to compute policies for a simple coordination game. We model the following situation:
John and Jim agreed to meet at a bar, but did not specify which of two bars to go to, the popular bar or the unpopular bar. John wants to meet Jim. Jim doesn't want to meet John, but John doesn't know this. Which bar will John and Jim choose?
#!r6rs (import (board) (rnrs)) (define bar-game (make-game '( (define actions '(popular-bar other-bar)) (define (jim-1) (solve goal-avoid identity-world (list john-0))) (define (jim-0) (solve goal-match identity-world (list john-0) (lambda () (sample-action .6)))) (define (john-0) (solve goal-match identity-world (list jim-0) (lambda () (sample-action .6)))) ))) (run-game bar-game (recursion-solver 5 2))
jim-1 other-bar: 0.9999999999878807 popular-bar: 1.2087651728459907e-11 jim-0 other-bar: 8.058434485672552e-12 popular-bar: 0.9999999999919361 john-0 other-bar: 8.058434485672552e-12 popular-bar: 0.9999999999919361
For more examples, see the
The template for a simple board game looks like this:
#!r6rs (import (board) (rnrs)) (define my-game (make-game [game-definition])) (run-game my-game [solver])
A game definition is a list of policy definitions and definitions of arbitrary other variables and functions that are used within the policies.
A policy definition has the following form:
(define (policy-name) (solve goal world policies action-prior))
The arguments to
solve must satisfy the following interface:
goalis a function that takes as input a state and returns a Boolean depending on whether the state satisfies the goal.
worldis a function that takes as input an action for the current player (first argument) and for the other players (remaining arguments) and returns a state.
policiesis a list of all players (policies) that the current player interacts with. This specifies the order of the remaining arguments to
action-prioris optional. If given, it is a thunk that returns an action. If not given, actions will be sampled uniformly from the list referenced by the variable
Currently, the only supported solver is
recursion-solver. It takes two arguments,
depth of recursion and
hardness of the conditions (optimization strength).