Git Product home page Git Product logo

phil-ivy's Introduction

Phil Ivy: An Increasingly Less Terrible Poker AI

  • Fully functional two-player No-Limit Texas Hold'em game built ground up in C++

Running the AI

  $ make
  $ ./main

That's it!

Monte Carlo

How it works

The Monte Carlo tree search algorithm uses the following four steps

  1. Selection
    • Starting from initial Node, choose which child node to explore more deeply, stop if Node is terminal
    • Explore vs. Exploit balanced using Upper Confidence Bound in Trees formula (UCT) alt text
    • wi/ni is the averaged expected value, c is the exploration constant, t is the visit count of the node and ni is the visit count of the considered child node
  2. Expansion
    • Create child nodes if they don't already exist
  3. Simulation
    • Quickly play out the game to a terminal state (folded or showdown) to find estimate of score
  4. Backpropagaion
    • Update parent nodes with results of simulation/selection
Our Code
// Call runSelection while there's still time left
Action monteCarlo(int maxTime, std::vector<int> deck);

// Expand child nodes if they don't exist and recursively choose child 
// node with highest naiveUCT score until terminal state is reached
void runSelection(std::vector<int> deck);

// When a new node is expanded, call() until a terminal game state is 
// reached. The results of the simulation is used to calculate
// expected value (EV)
void runSimulation(std::vector<int> deck);

// When a terminal state is reached, update the parents visit count
// and expected value
void backprop(double, double);

// Calculates score used by runSelection() to pick next node
void naiveUCT(std::vector<double>&);

phil-ivy's People

Contributors

yizhouuuuu avatar

Stargazers

 avatar Stephen Zhao avatar

Watchers

James Cloos avatar Stephen Zhao avatar Owen Qian avatar  avatar

Forkers

michael-z

phil-ivy's Issues

All in bug; doesn't deal all 5 cards

In manual decision entry mode, if you go all in on the first hand, only 4 board cards end up being dealt.

Likely an off by 1 error in all in handling for loop.

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.