Giter VIP home page Giter VIP logo

mancala's Introduction

Mancala

PyPI - Downloads

Mancala board game written in python.

img

Features & Road maps

  • Mancala playable on CLI
  • Cmpatible with the gym API
  • Can train RL agents
  • Mancala playable on GUI

Installation

$ pip install mancala

Usage

Play a game with agents

$ mancala play --player0 human --player1 random

Compare each agents and plot their win rates

The values are player1's (second move) win rates in percentage

$ mancala arena
              p0_random  p0_exact  p0_max  p0_minimax  p0_negascout
p1_random          50.0      53.0     3.0         0.0           0.0
p1_exact           42.0      48.0     4.0         1.0           1.0
p1_max             95.0      91.0    41.0         0.0           3.0
p1_minimax        100.0      96.0    87.0        30.0          39.0
p1_negascout      100.0      97.0    84.0        19.0          32.0

Algorithms

Mancala is a game with perfect information. マンカラは完全情報ゲームです。

Mini-Max

Mini-max is an algorithm for n-player zero-sum games. The concept is to assume the opponent will take their best move and try to minimize them.

Value Iteration

Using Dynamic Programming (DP), calculate value for states and memorize them. Use the value to plan future actions.

Other implementations

Policy Iteration

Using Dynamic Programming (DP), calculate value for states and memorize them. Use the value and policy for planning.

References

Multi agent RL

mancala's People

Contributors

qqpann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mancala's Issues

One should not be able to fill into opponent's point pocket

Example:

============================
[ 4]  9  0  1  0  2  1
----------------------------
      1  1  0  1 13  0 [15]
============================
turn: <HumanAgent id:0>
      1  2  3  4  5  6
0.09 0.14 0.09 0.11 0.12 0.09
Take from a pocket (chose the index)
> 5
<MancalaState: [[ 2  2  1  2  0  1 16  2  3  1  2  1 10  5], 1]>

============================
[ 5] 10  1  2  1  3  2
----------------------------
      2  2  1  2  0  1 [16]
============================
turn: <NegaScoutAgent id:1>
[7, 8, 9, 10, 11, 12]
[-0.12, -0.12, -0.12, -0.12, -0.12, -0.12]
<MancalaState: [[ 2  2  1  2  0  1 16  0  4  2  2  1 10  5], 0]>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.