dickreuter / Poker

Fully functional Pokerbot that works on PartyPoker, PokerStars and GGPoker, scraping tables with Open-CV (adaptable via gui) or neural network and making decisions based on a genetic algorithm and montecarlo simulation for poker equity calculation. Binaries can be downloaded with this link:
http://www.deepermind-pokerbot.com
GNU General Public License v3.0
1.96k stars 501 forks source link
artificial-intelligence poker pokerstars

DeeperMind pokerbot for pokerstars, partypoker and GGPoker

This pokerbot plays automatically on Pokerstars, Partypoker and GG Poker. Any other table can be mapped as well. It works with image recognition, montecarlo simulation and a basic genetic algorithm. The mouse is moved automatically and the bot can potentially play for hours based on a large number of parameters.

You can download the binaries and run the executable directly from here: http://www.deepermind-pokerbot.com

Running the bot:

Partypoker:

* Use Fast Forward Tables
* Select Official PartyPoker table scraper

.. figure:: doc/partypoker.gif

Pokerstars:

.. figure:: doc/ps-example.png

GGPoker:

Make sure your GGPoker setup looks as follows when using it with the Official GGPoker Table:

.. figure:: doc/ggpk2.png

General setup:

If you just want to run the bot, please do the following:

Install the binearies of the bot from here: http://www.deepermind-pokerbot.com

You can then immediately run the bot. It will analyze the poker client, move the mouse and play in accordance with one of its pre-programmed strategies. Most of the strategies are based on zoom or Fast Forward tables. You are welcome to edit and imporve any strategies to optmize the play of the bot for your needs.

In most cases it may be useful to put the poker client inside a virtual machine to avoid it from interfering with the bot. Also, the bot will then be able to control the mouse inside the virtual machine, without blocking the whole computer:

Strategy Analyzer

Looking at the stacked bar chart in more detail, gives you clues how to adjust the strategy to maximize your wins:

.. figure:: doc/analyzer_bar2.png

Analyze individual rounds within each stage:

.. figure:: doc/analyzer_bar3.png

Analyze individual hands:

.. figure:: doc/strategy_analyzer.gif

Strategy editor

A variety of factors are taken into consideration when the bot makes decisions and they can be adjusted in the strategy editor:

.. figure:: doc/strategy2.png

A variety of other options can be edited for each strategy:

.. figure:: doc/strategy_editor.gif

Advice how to improve strategies:


* You will generally require at least 2000 hands played with a strategy to draw any conclusions. Even better 5000 hands. Anything less than 1000 hands is completely random.
* Best buy in more than the minimum, this will improve the bots performance as it has more leeway to play. For example on a 0.01/0.02 table, buy in more than the minimum of $2. Ideally start with $4 or even more.
* Look at the strategy analyzer and work your way backwards. First improve the River play, then once this is good move on to the Turn, then to the Flop etc. This is because the game is path dependent.
* If you make changes in the ranges, you may need to adapt all minimum equities as it changes the equity calculation.
* Good Luck!

Full version:

The full version allows you to:

To purchase, please follow this link. You'll then receive a password within 24 hours. http://www.deepermind-pokerbot.com/purchase

Alternatively you can contact me via email or discord and request a password directly and pay bitcoin to: 1Py5o4WLYMizXc8pFPqzD4yeCAm53BhJit

You can also get a free subscription if you make some meaningful contribution to the codebase.

The easiest way to contribute is by:

Mapping new tables

The bot can learn to read new tables, either by using templates or by training a neural network that uses data augmentation based on the given templates.

Click this link to see a Video description how to add a new table <https://rb.gy/jut3ws>_ or watch the video on www.deepermind-pokerbot.com

The setup to add new tables looks like this:

.. figure:: doc/scraper.png

Notes to keep in mind:

IT IS NOT RECOMMENDED TO CONDUCT TESTS WITH REAL ACCOUNTS UNTIL YOU VERIFY THE CORRECT FUNCTIONING OF THE BOT (ALSO TO AVOID LOSS OF ACCOUNTS AND CAPITAL)

Running via docker

Running via python source code

Packages and modules:


main.py: entry point

poker.scraper
^^^^^^^^^^^^^

Contains user interface and routines that help map new tables

- ``recognize_table``: Functions to recognize the different items on the table, based on the created mapping
- ``screen_operations``: Various routines, such as taking screen shots, cropping etc
- ``table_setup``: Routines in relation to the gui
- ``ui_table_setup``: QT user interface. Corresponding py file is created with makegui.bat in the parent folder. To edit the gui download QT Designer and open the .ui file.

poker.decisionmaker
^^^^^^^^^^^^^^^^^^^

-  ``decisionmaker.py``: The ultimate decision what action should be taken based on the input
-  ``montecarlo_numpy2.py``: fast numpy based montecarlo simulation to
   calculate equity. Not yet working correctly. Some tests are failing. Feel free to fix them.
-  ``montecarlo_python.py``: relatively slow python based montecarlo for equity calculation. Supports
   preflop ranges for other players.

poker.tests
^^^^^^^^^^^

-  ``test_montecarlo_numpy.py``: tests for the numpy montecarlo
-  ``test_pylint.py``: pylint and pydoc tests to ensure pep8 standards and static code analysis

Graphical user interface (gui)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- Download QT for open source project: https://www.qt.io/download-open-source
- Use the qt designer to edit any of the .ui files in gui/ui

Next Priorities
---------------

- [ ] Update tests. Some are currently outdated. More tests are needed
- [ ] Add more strategies
- [ ] Switch from using pytesseract to tesserocr to speed up OCR, this should considerably speed up the bot
- [ ] Better Analyze the collected data to improve strategies

Making fixes in the code

It will be hard for one person alone to beat the world at poker. That's why this repo aims to have a collaborative environment, where models can be added and evaluated.

To contribute do the following:

FAQ

No top left corner


- Make sure everything looks exactly like in the picture at the top of this documentation.
    * The buttons need to look exactly like this and it needs to be in English and not scaled. Colours need to be standard.
    * Most tables are mapped to real money. They won't work with play money.
    * The poker table window has to be fully visible and cannot be scaled, otherwise it won't be detected properly.
    * In Partypoker, when you open the table, choose table options and then choose **back to default size** to make sure the table is in default size.

- Tables are mapped for fast forward and zoom games with real money. Use the Supersonic3 table for Partypoker or McNaught table in Pokerstars.
- If things still don't work, consider teaching it a new table as described above.

Cards not recognized

Do I need to use a virtual machine?


- For Pokerstars you definitely do, otherwise you will be blocked and your account will be frozen within minutes. For Partypoker I'm not sure. But best check the terms and conditions.

Analyzing the log and reporting problems

Related projects

Training the bot by playing against itself is a separate project which can be found here: https://github.com/dickreuter/neuron_poker