Giter Site home page Giter Site logo

andrewprock / pokerstove Goto Github PK

View Code? Open in Web Editor NEW
781.0 85.0 348.0 5.48 MB

poker evaluation and enumeration software

License: BSD 3-Clause "New" or "Revised" License

CMake 0.77% C++ 92.96% Python 4.81% C 0.62% Shell 0.14% Starlark 0.53% Batchfile 0.03% HTML 0.04% SCSS 0.06% SWIG 0.04%

pokerstove's Introduction

PokerStove

OpenHUB Metrics

PokerStove is a highly hand optimized C++ poker hand evaluation library. The Win32 Hold'em GUI was first released in 2002, and has been available as freeware since it's first release.

The core libraries of pokerstove are being open sourced. The project is currently in the process of reviewing and publishing the code. As code is reviewed and code sanitized further commits will be added.

Please find the old installer in the win32 directory. That installer should install a version of PokerStove which will not expire at any time. You can also find the apk file for the Android version of the utility in the android folder.

Libraries

peval

This is a c++ poker hand evaluation library. The main design goals of the library are generality, extensibility, and ease of use. There are evaluators for fourteen variants of poker. Additionally, there are various card manipulation and query tools built into the CardSet class.

Programs

ps-eval

A tool for poker hand evaluation. It demonstrates how to use the peval library, and to create evaluators for the different variants of poker.

ps-colex

A utility for viewing colexicographical index for sets of cards.

Building

The pokerstove libraries come with build scripts for cmake. This should allow you to build it on any platform with minimal tweaking. This project has been successfully build under linux/g++, windows/vc2010 and OSX/XCode so far.

In order to build the libraries you'll need the following installed on your platform of choice:

  • boost, version 1.46 or higher
  • cmake, version 3.14 or higher

Linux

To install the dependencies with apt get:

apt-get install libboost-all-dev cmake

To build under linux using cmake, create a build directory, invoke cmake on the programs directory, then build. The command below uses four threads, but you may set it according to your own system.

git clone https://github.com/andrewprock/pokerstove.git
cmake -DCMAKE_BUILD_TYPE=Release -S \. -B build
cmake --build build --target all test -j 4

You should then be able to execute the simple command line example:

pokerstove/build $ ./bin/ps-eval
Allowed options:
  -? [ --help ]          produce help message
  -g [ --game ] arg (=h) game to use for evaluation
  -b [ --board ] arg     community cards for he/o/o8
  -h [ --hand ] arg      a hand for evaluation
  -q [ --quiet ]         produce no output

   For the --game option, one of the follwing games may be
   specified.
     h     hold'em
     o     omaha/8
     O     omaha high
     r     razz
     s     stud
     e     stud/8
     q     stud high/low no qualifier
     d     draw high
     l     lowball (A-5)
     k     Kansas City lowball (2-7)
     t     triple draw lowball (2-7)
     T     triple draw lowball (A-5)
     b     badugi
     3     three-card poker

   examples:
       ps-eval acas
       ps-eval AcAs Kh4d --board 5c8s9h
       ps-eval AcAs Kh4d --board 5c8s9h
       ps-eval --game l 7c5c4c3c2c
       ps-eval --game k 7c5c4c3c2c
       ps-eval --game kansas-city-lowball 7c5c4c3c2c

Windows

Getting boost to work under windows can be a bit of a challenge. One of the easier ways is to install precompiled librares. There is a batch of them available at sourceforge. If you're working with Visual Studio 2010, you will probably need the 32 bit libraries. [boost precomplied libraries] (http://sourceforge.net/projects/boost/files/boost-binaries/1.53.0/)

Under windows, the cmake gui can be used to construct solution and project files for Visual Studio 2010. To do this, browse source to locate the programs directory git/pokerstove/programs. Then create a build dir for the project. At the bottom of the gui click Configure, then Generate. You may have to edit the git/pokerstove/programs/CMakeLists.txt to point cmake to your installation of boost.

Once you've done that, you should be able to select

Menu->Build->Build Solution

to build the sample program.

OSX

In order to build under Max OSX, you'll need to install XCode, git, cmake, macports, and boost. The first four can be installed in the conventional manner, with XCode coming form the App Store, cmake, git and macports downloaded from the web. The macports package is a typical unix package management utility and is required to install boost. Once you've installed and selfupdate'd macports, you can install boost:

sudo port install boost -no_static

Or

brew install boost cmake

From there you can run the cmake gui as in windows. This will create an XCode project which should compile the sample utility. Alternatively, follow the command line cmake instructions in the Linux section.

Python support

Python support is done via swig integration. This has only been developed and tested for Ubuntu at this point in time.

In order for python libraries to work, you will need to install:

sudo apt install python3 swig

If you would like to also build the Python library as well, append the directive when the first cmake invocation is run:

cmake -DCMAKE_BUILD_TYPE=Release -S \. -B build -DBUILD_PYTHON=ON

Once you have built the project with Python support there will be a python loader file and a shared object file. To test run the script from the build directory:

PYTHONPATH=python/pokerstove/ ../src/lib/python/test-python

For regular use you'll want to export the PYTHONPATH variable to your shell:

export PYTHONPATH=~/git/pokerstove/build/python/pokerstove/

pokerstove's People

Contributors

andrewprock avatar bitdeli-chef avatar jdoerrie avatar jmr avatar l0stman avatar lucasmitrak avatar nanaban avatar rakhimov avatar shindavid avatar xiaotianrandom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pokerstove's Issues

Can't compile pokerstove as a drop-in library

I'm trying to include pokerstove in a c++ project. I'm on mac, and am having trouble compiling and including the files in my project.

I'm running the default program you have in the peval documentation and running the following command to compile it:

> g++ peval_helloworld.cpp -I pokerstove/src/lib/

Here's the error:

peval_helloworld.cpp:11:23: error: invalid use of incomplete type 'pokerstove::Card'
    CardSet big_slick(Card(Rank('A'),Suit('s')),
                      ^~~~~~~~~~~~~~~~~~~~~~~~~
pokerstove/src/lib/pokerstove/peval/Rank.h:117:18: note: forward declaration of 'pokerstove::Card'
    friend class Card;
                 ^
peval_helloworld.cpp:12:23: error: invalid use of incomplete type 'pokerstove::Card'
                      Card(Rank('K'),Suit('s')));
                      ^~~~~~~~~~~~~~~~~~~~~~~~~
pokerstove/src/lib/pokerstove/peval/Rank.h:117:18: note: forward declaration of 'pokerstove::Card'
    friend class Card;
                 ^
2 errors generated.

And the code:

#include <iostream>
#include <pokerstove/peval/CardSet.h>

using pokerstove::CardSet;
using pokerstove::Card;
using pokerstove::Rank;
using pokerstove::Suit;

int main(void)
{
    CardSet big_slick(Card(Rank('A'),Suit('s')),
                      Card(Rank('K'),Suit('s')));
    std::cout << big_slick.str() << std::endl;

    CardSet dead_mans_hand("AcAs8d8hJs");
    std::cout << dead_mans_hand.str() << std::endl;
}

ps-eval hangs when no board present

On the command line ps-eval hangs. For example
ps-eval --hand AcAd
just hangs but
ps-eval --hand AcAd --board AhTcTh
provides output:
The hand AcAd has 99.4682 % equity (1064004 495 0 0)
A random hand has 0.531775 % equity (5196 495 0 0)

Linux version 4.19.0-6-amd64 ([email protected]) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 SMP Debian 4.19.67-2+deb10u2 (2019-11-11)

Conversation

Hi Andrew, thanks for your library, it is great. I have 2 questions:

  1. If I install Pokerstove from installer (ver 124), and run it on my machine(Win7 x64), it says that the version is expired and I should download the other one. But 124 is the leatest, isn't it?

  2. It would be great to have more API documentation, for example how can I simulate next situation:
    hand1: KcJd
    hand2: 22+,A2s+,K2s+,Q2s+
    What class takes hand range in string (22+,A2s+ etc) and converts it to some internal structure?
    What function shoul I call to get Equity like Pokerstove.exe shows: 48% vs 52%

Thanks,
Max

Licence decision finalised?

Hi Andrew, thanks for making this code available it looks like a great asset. The Readme mentions a decision pending regarding the licence but there is a licence present in the repository, have you settled on this licence or is it subject to change?

Thanks,

Matt

NaN comparison between two cards + board

The test program below reports:

The whole deck has 52 cards
There are 1 two card combinations
There are 1 two card combinations
The board has 3 cards
The hand As6s has nan % equity (0 0 0 0)
The hand 9c9s has nan % equity (0 0 0 0)

Please let me know if the test program is using the APIs incorrectly.

#include <iostream>
#include <vector>

#include <pokerstove/peval/Card.h>
#include <pokerstove/penum/ShowdownEnumerator.h>

int main() {

using namespace pokerstove;
using namespace std;

CardSet completeDeck;
completeDeck.fill();
cout << "The whole deck has " << completeDeck.size() << " cards" << endl;

CardDistribution hand1;
hand1.parse("As6s");
cout << "There are " << hand1.size() << " two card combinations"  << endl;

CardDistribution hand2;
hand2.parse("9c9s");
cout << "There are " << hand2.size() << " two card combinations"  << endl;

CardSet board;
board.insert(Card(Rank('9'), Suit('d')));
board.insert(Card(Rank('7'), Suit('d')));
board.insert(Card(Rank('2'), Suit('c')));

cout << "The board has " << board.size() << " cards" << endl;

ShowdownEnumerator showdown;
vector<EquityResult> result = showdown.calculateEquity(
    vector<CardDistribution>{hand1, hand2},
    board,
    PokerHandEvaluator::alloc("h")
);

double share1 = result.at(0).winShares + result.at(0).tieShares;
double share2 = result.at(1).winShares + result.at(1).tieShares;
double total = share1 + share2;

cout << "The hand As6s has "  << share1 / total * 100  << " % equity (" << result.at(0).str() << ")" << endl;
cout << "The hand 9c9s has "  << share2 / total * 100  << " % equity (" << result.at(1).str() << ")" << endl;
}

Monte carlo simulations

Hi all,

I've been able to do absolute simulations, whereby all possible scenarios are evaluated.

Is there a direct method of conducting monte carlo simulations with the library? By this I effectively mean random sampling of possible scenarios for a preset number of simulations.

Thanks in advance,

Bez

Some questions and a minor suggestion on the readme

First off, thanks so much for putting this up!

I am new to C++ development and I just got the project built and into VS and started looking at the code. I wanted to make sure that I am understanding the components that are currently available and the components that you are still reviewing the licensing on.

All the pokerstove UI code and the higher level functions it uses to compute the equity of 2 ranges vs each other are not available at this time, correct? That is, to do an equity calculation of two ranges preflop I would need to write my own function to loop through all the hands in the range, deal every possible flop, and then call pseval to get the ranks and compare them?

Assuming my understanding is correct, do you have any sense of when you might put up the code for Pokerstove itself. The UI for range selection in particular is very nice :)

Also I had one minor suggestion, it might be good to mention that svn needs to be installed (and in the PATH on windows) for cmake to work, do to the tests being pulled from an external svn repo, I got a bit confused by that.

Thanks again.

ps-eval does not accept pokerstove style ranges

For example, using simple preflop ranges:

$ ./ps-eval "77+,ATs+,KTs+,QJs,AJo+,KQo" "99-22,AQs-A8s,A5s-A4s,K9s+,Q9s+,J9s+,T8s+,97s+,87s,76s,65s,AQo-AJo,KQo"
Assertion failed: (dists[i].size() > 0), function calculateEquity, file /src/lib/pokerstove/penum/ShowdownEnumerator.cpp, line 40.
Abort trap: 6

Also if you start your ranges off using individual cards, then add a range like AQo+ below:
./ps-eval "KcQc" "6c5c,AQo+"
The hand KcQc has 63.6617 % equity (1083296 6785.5 0 0)
The hand 6c5c,AQo+ has 36.3383 % equity (615437 6785.5 0 0)

It works, but the calculation is incorrect. Actual results according to PokerStove GUI should be 31.3% KcQc and 68.624% to 6c5c,AQ+.

Simple functionality

Are we able to continue to improve this amazing program with a couple key features for the user

  • Right clicking with mouse over player clears the current cards. This helps so that players dont have to go into the player option each time to clear the data in the current box
    -prebuild player percentages (6.5% hands, 15%, 20%). This helps so players can select from player drop down menu of their own player hands that they want to look at odds again.
    -maybe a save feature allowing to save pre-built hands or setups

again this is a fricken awesome app. thank you so much for taking the time to do this!

Ubuntu 12.04+ Tips

A couple tips to get working- but works great otherwise, sorry I didn't fork fix, but FYI:

  1. Deps:
    apt-get install libboost-all-dev cmake subversion

  2. memcpy error: ./src/lib/pokerstove/penum/ShowdownEnumerator.cpp
    Add:

include

  1. After build fails: ./src/build/programs/ps-lut/CMakeFiles/ps-lut.dir/flags.make
    Remove: -std=c++11
    Add: -std=c++0x

Implementation of pokerstove functionality

Hi Andrew,

Thanks so much for open sourcing this library. I'm having a little difficulty in implementing pokerstove functionality. I'm trying to create a managed class that interfaces with the peval library. Anyway, it looks to me like that the evaluateShowdown function implements the pokerstove functionality. However, when passing a simple cardset to the function such as p1: AdKd p2: AcAs board: 6sJc5h, the winshare for p2 is "1" with all other returned equityresult variables as "0". When passing the same cardset for both players, the tieshares are 0.5.

Do you have a rough dot point guide on implementing the pokerstove functionality? It would be great if you could create a simple example similar to ps-eval which takes a number of hands and the board and returns equity results.

Thanks for any help.

Cheers,

Matt

calculate readable winning hand format

I am a noob at CPP programming yet I'm trying to integrate the library with Python.
While the example program ps-eval explains evaluating the winning hand out of the input samples, is there any way to calculate winning cards out of the winning sample?
For eg assuming:
Board : AsKsQs2c5c
Hand1 : JsTs
Hand2: 3c7s
Here Hand1 wins with a straight flush. So how do I evaluate to "Straight Flush AsKsQsJsTs" or something like that? Basically winning cards and winning label. Is that possible with the library?

ps-eval command not found

I followed your steps, cmake .., make and then tried to run some commands. I just keep getting that ps-eval is not working.

I see you are in a ~/cmake/ directory though, I dont have this one.

What could be the problem?

Delete this

Hi guys, I just registered to this site to ask you for a 169x169 Matrix of the preflop equities every hand vs every hand. I'm very sorry if this is the wrong section. I'm googling for several hours now. There used to be a link to what I need (http://www.pokerstove.com/analysis/preflopeq.php), but it's down. I hope someone can help me out. You'd save my life!

ps-eval freezes with large ranges and no "--board" parameter

Running the following command hangs for me:

ps-eval 7s7d asqs,acqc,adqd,ahqh,asjs,acjc,adjd,ahjh,asts,actc,adtd,ahth,as9s,ac9c,ad9d,ah9h,as8s,ad8d,ah8h,as5s,ac5c,ad5d,ah5h,as4s,ac4c,ad4d,ah4h,ksqs,kcqc,kdqd,khqh,ksjs,kcjc,kdjd,khjh,ksts,kctc,kdtd,khth,ks9s,kc9c,kd9d,kh9h,qsjs,qcjc,qdjd,qhjh,qsts,qctc,qdtd,qhth,qs9s,qc9c,qd9d,qh9h,asqc,asqd,asqh,acqs,acqd,acqh,adqs,adqc,adqh,ahqs,ahqc,ahqd,ksqc,ksqd,ksqh,kcqs,kcqd,kcqh,kdqs,kdqc,kdqh,khqs,khqc,khqd,asjc,asjd,asjh,acjs,acjd,acjh,adjs,adjc,adjh,ahjs,ahjc,ahjd,jsts,jctc,jdtd,jhth,js9s,jc9c,jd9d,jh9h,ts9s,tc9c,td9d,th9h,ts8s,td8d,th8h,2s2c,2s2d,2s2h,2c2d,2c2h,2d2h,3s3c,3s3d,3s3h,3c3d,3c3h,3d3h,4s4c,4s4d,4s4h,4c4d,4c4h,4d4h,5s5c,5s5d,5s5h,5c5d,5c5h,5d5h,6s6c,6s6d,6s6h,6c6d,6c6h,6d6h,7s7d,7s7h,7d7h,8s8d,8s8h,8d8h,9s9c,9s9d,9s9h,9c9d,9c9h,9d9h,6s5s,6c5c,6d5d,6h5h,7s6s,7d6d,7h6h,8s7s,8d7d,8h7h,9s8s,9d8d,9h8h,9s7s,9d7d,9h7h

However, when I run the same exact ranges in the GUI (leaving out the board), results come back instantly:

Hand 0: 57.789% 57.43% 00.36% 152421544 955711.50 { 7d7s }
Hand 1: 42.211% 41.85% 00.36% 111074373 955711.50 { 99, 8d8h, 8d8s, 8h8s, 7d7h, 7d7s, 7h7s, 66-22, AQs-A9s, Ad8d, Ah8h, As8s, A5s-A4s, K9s+, Q9s+, J9s+, T9s, Td8d, Th8h, Ts8s, 9d8d, 9h8h, 9s8s, 9d7d, 9h7h, 9s7s, 8d7d, 8h7h, 8s7s, 7d6d, 7h6h, 7s6s, 65s, AQo-AJo, KQo }

Also, I notice that when I add "--board AcKh3s" to the ps-eval command above it returns instantly.

Tie count wrong in PokerStove?

Hi Andrew

I am running PokerStove version 1.24.
I picked pre-flop hands: Player 1 = Jc5c, and Player 2 = QdTd, and evaluated using Enumerate All.
The results are these:

Text results appended to pokerstove.txt

1,712,304 games 0.015 secs 114,153,600 games/sec

Board:
Dead:

equity  win     tie           pots won  pots tied   

Hand 0: 35.525% 35.06% 00.46% 600384 7911.00 { Jc5c }
Hand 1: 64.475% 64.01% 00.46% 1096118 7911.00 { QdTd }

However, 600384 + 1096118 + 2*7911.00 doesn't add up to 1,712,304.
The win/loss are correct, but ties should be 7901.00, not 7911.00.

Can you please release the command line version of PokerStove?

The ps-eval script is missing a lot of functionality like expandable ranges, board and dead cards.

Through some research it appears that this already exists:

Yes there is, but it is not currently available for general distribution. If you are interested in purchasing it, send me email and I'll consider your situation.The price for the command line version is $300

Has this been released? I just tried running PokerStove.exe on command line and don't see any options, the GUI just pops up.

Thanks!

How can I run ps-eval?

Hello everyone
Could you explain how can I run correctly ps-eval? I did not run ps-eval just following the README.md and I didn't understand what I have to do.
I'm using Ubuntu 14.04 and pokerstove was installed correctly
Thanks

Problem with CardSet::fill() and CardSet::size()

Hi,

Right now CardSet::fill() is implemented as

void   fill()  { _cardmask = 0; _cardmask = ~_cardmask; }

So calling size() on a newly filled CardSet would return 64 although there are only 52 cards in the deck. Unless I'm missing something obvious, wouldn't something like the following code fix the issue?

void fill() { _cardmask = ~(0xffffffffffffffff<<CardSet::STANDARD_DECK_SIZE); }

Regards,

Compile Error: File not Found

I am not able to compile a version on my Debian system. Hopefully somebody is able to give me a hint how to solve my issue.

After correcting the compiler flags as indicated in #24,
I get the following error message while compiling
"Building CXX object lib/pokerstove/peval/CMakeFiles/peval_tests.dir/Rank.test.cpp.o
/opt/pokerstove/src/lib/pokerstove/peval/Rank.test.cpp:1:25: fatal error: gtest/gtest.h: Datei oder Verzeichnis nicht gefunden
compilation terminated.
make[2]: *** [lib/pokerstove/peval/CMakeFiles/peval_tests.dir/Rank.test.cpp.o] Fehler 1
make[1]: *** [lib/pokerstove/peval/CMakeFiles/peval_tests.dir/all] Fehler 2
make: *** [all] Fehler 2
"

Apologies for the error message being in german.
"Fehler" means Error
"Datei oder Verzeichnis nicht gefunden" means "File or directory not found"

However the file gtest.h is located in
"
./src/ext/googletest/googletest/include/gtest/internal/custom/gtest.h
./src/ext/googletest/googletest/include/gtest/gtest.h
"

Very slow execution of ShowdownEnumerator::calculateEquity()

I am trying to run the basic example of ps-eval where it calculates the equity of As6s against a random hand, but the it seems to run extremely slow when it runs

vector<EquityResult> result = showdown.calculateEquity(
    vector<CardDistribution>{anyTwo, holeCards},
    CardSet(""),
    PokerHandEvaluator::alloc("h")
);

It runs for several minutes without finishing.
I am running 64bit Ubuntu 16 on Pentium(R) Dual-Core CPU T4400 @ 2.20GHz

Edit:
The issue seems to be in the incr(int n) method in PartitionEnumerator2. If I just return false at the beginning of it then the program finishes instantaneously.

Compile Errors under C++ VS10 Express

have not worked out a fix for these yet, will let you know when I do
Microsoft Visual Studio 2010
Version 10.0.30319.1 RTMRel
Microsoft .NET Framework
Version 4.7.03056 RTMRel

Installed Version: VC Express

Microsoft Visual C++ 2010 01013-532-2002287-70613
Microsoft Visual C++ 2010

Boost = C:\local\boost_1_53_0\boost

CMAKE Version = 2.8.12.2

1>------ Build started: Project: ZERO_CHECK, Configuration: Debug Win32 ------
2>------ Build started: Project: ps-eval, Configuration: Debug Win32 ------
2> main.cpp
2>....\ps-eval\main.cpp(53): error C2143: syntax error : missing ',' before ':'
2>....\ps-eval\main.cpp(53): error C2530: 'hand' : references must be initialized
2>....\ps-eval\main.cpp(53): error C2143: syntax error : missing ';' before '{'
2>....\ps-eval\main.cpp(54): error C2660: 'std::vector<_Ty>::emplace_back' : function does not take 0 arguments
2> with
2> [
2> _Ty=pokerstove::CardDistribution
2> ]
2>....\ps-eval\main.cpp(60): error C2660: 'std::vector<_Ty>::emplace_back' : function does not take 0 arguments
2> with
2> [
2> _Ty=pokerstove::CardDistribution
2> ]
2>....\ps-eval\main.cpp(70): error C2143: syntax error : missing ',' before ':'
2>....\ps-eval\main.cpp(70): error C2530: 'result' : references must be initialized
2>....\ps-eval\main.cpp(70): error C2143: syntax error : missing ';' before '{'
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


The problem line in question is some weird short hand form of a for() loop that I've never seen before.
Is there an alternative way to write this?

for (const string& hand : hands) {
handDists.emplace_back();
handDists.back().parse(hand);
}

Linux compiling issue - wrong location of CMakeLists.txt

Following instruction for linux the error occurred at "cmake .."

CMake Error: The source directory "(my home)/pokerstove/src/build/pokerstove" does not appear to contain CMakeLists.txt.

Moving CMakeLists.txt does exist in another directory and was moved to ~/pokerstove/src/build/pokerstove and another attempt was made that resulted in errors

~/pokerstove/src/build$ cmake ..
-- The C compiler identification is GNU 4.7.2
-- The CXX compiler identification is GNU 4.7.2
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
statusbuilding for unix
CMake Error at /usr/share/cmake-2.8/Modules/FindBoost.cmake:1194 (message):
Unable to find the requested Boost libraries.

Unable to find the Boost header files. Please set BOOST_ROOT to the root
directory containing Boost or BOOST_INCLUDEDIR to the directory containing
Boost's headers.
Call Stack (most recent call first):
CMakeLists.txt:23 (find_package)

status** Boost Include: Boost_INCLUDE_DIR-NOTFOUND
status** Boost Libraries:
status** Boost Libraries:
-- Could NOT find Subversion (missing: Subversion_SVN_EXECUTABLE)
CMake Error at /usr/share/cmake-2.8/Modules/ExternalProject.cmake:1071 (message):
error: could not find svn for checkout of googletest
Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/ExternalProject.cmake:1542 (_ep_add_download_command)
ext/gtest/CMakeLists.txt:5 (ExternalProject_Add)

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
Boost_INCLUDE_DIR (ADVANCED)
used as include directory in directory /home/mccartney/pokerstove/src/ext/gtest

-- Configuring incomplete, errors occurred!

cmake doesn't find googletest

I'm investigating why the homebrew formula for pokerstove is having build problems. The code in pokerstove does:

add_subdirectory(src/ext/googletest)
find_library(gtest REQUIRED)

... I'm not sure if find_library that will ever find the local copy or if this assumes that it's in /usr/lib? Or maybe it worked on older versions of cmake but broke more recently?

Anyway when running cmake 3.19.4 I am seeing:

-- Found Threads: TRUE
CMake Error at CMakeLists.txt:18 (find_library):
  Could not find gtest using the following names:


-- Configuring incomplete, errors occurred!

As a workaround I am just going to switch to find_package and use homebrew's own copy of googletest. With this it seems to build fine.

Googletest svn no longer exists

Googletest svn seems to no longer exist. So I had to use a mirror of it hosted on github: https://github.com/stp/googletest

So I had to replace in src/ext/gtest/CMakeLists.txt
SVN_REPOSITORY http://googletest.googlecode.com/svn/trunk by GIT_REPOSITORY https://github.com/stp/googletest

Also I had to add -lpthread -std=c++11 in order to compile the project in the following files

  • src/lib/pokerstove/penum/CMakeLists.txt
  • src/lib/pokerstove/peval/CMakeLists.txt
  • src/lib/pokerstove/util/CMakeLists.txt

Hope it will be helpful.

Understanding the Canonization functionality

Hi Andrew,

I am using the pokerstove library in a number of ways in an application I am building. It is amazing, thanks for open sourcing it!

To better understand that functionality I made something that directly mimics the functionality of Pokerstove. However, I am not achieving the same level of performance that the desktop version of pokerstove gets. My code produces the exact same output but takes several times as long to do so.

I think the issue is likely that I am not understanding one to canonize suits. Can you give me some insight through two simple examples:

First, a situation involving a board:

Player 1 has AsKs, player 2 has AhQs and the board is 2h.

Pokerstove says it deals 178,365 hands in this case which is 47 choose 4. However, in theory it should be able to consider clubs and diamonds as the same in this situation and instead deal 34 choose 4. Is this correct? Is there a way to use the canonize options in general to ignore suits in situations where a flush in that suit is not possible and where there is no card removal to consider for that suit and is the desktop version of pokerstove doing that?

Second, preflop situations:

If we take the same two hands as above but remove the board card, pokerstove is about 10x faster even though it says it dealt 1,712,304 games (10 times as many).

How exactly are you using the suit canonization to make the preflop calculations so fast while still accounting for the fact that AhKs has more equity vs KhQs than against KcQd? I see the option to canonize one hand to another, but how are you achieving this performance boost in 3 way scenarios?

Any insight is greatly appreciated.

Thanks!

compile errors

Hi,

I had to change some makefiles to get pokerstove compiled:
added -std=c++11 to CMAKE_CXX_FLAGS in ./src/lib/pokerstove/penum/CMakeLists.txt

and -lpthread to ./CMakeFiles/util_tests.dir/link.txt

Could not find gtest using the following names

Good day,

Can't build it..
Debian testing, kernel 5.10.0-1-686 #1 SMP Debian 5.10.4-1 (2020-12-31) i686 GNU/Linux

`$ cmake -DCMAKE_BUILD_TYPE=Release ..
-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: /usr/bin/python (found version "2.7.18")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
CMake Error at CMakeLists.txt:18 (find_library):
Could not find gtest using the following names:

-- Configuring incomplete, errors occurred!
See also "/usr/local/src/pokerstove/build/CMakeFiles/CMakeOutput.log".
See also "/usr/local/src/pokerstove/build/CMakeFiles/CMakeError.log".
`
See also attached '/usr/local/src/pokerstove/build/CMakeFiles/CMakeError.log'
CMakeError.log

'libpthread-stubs0-dev' is installed:

$ apt policy libpthread-stubs0-dev libpthread-stubs0-dev: Installé : 0.4-1 Candidat : 0.4-1 Table de version : *** 0.4-1 500 500 http://deb.debian.org/debian testing/main i386 Packages 100 /var/lib/dpkg/status
What can I try now?
Thanks in advance ;)

Build issue

Hi Andrew (and co),

Thanks for all your work making this available. I've been trying to get it up and running on a Windows 10 PC and am running into an issue while building in Visual Studio.
The error I get is LNK1104: cannot open 'peval.lib'. I'm a novice to C++, have been searching all day for a fix but no joy. I can see peval.lib under Linker -> Input -> Additional Dependencies.
What am I doing wrong?

Thanks
Ray

Build fails with MSVS 2012: multiple inclusions?

------ Build started: Project: pseval, Configuration: Debug Win32 ------
cl : Command line warning D9002: ignoring unknown option '-std=c++0x'
main.cpp
libboost_program_options-vc110-mt-gd-1_53.lib(value_semantic.obj) : error LNK2005: "public: virtual char const * __thiscall boost::program_options::error_with_option_name::what(void)const " (?what@error_with_option_name@program_options@boost@@UBEPBDXZ) already defined in boost_program_options-vc110-mt-gd-1_53.lib(boost_program_options-vc110-mt-gd-1_53.dll)
libboost_program_options-vc110-mt-gd-1_53.lib(value_semantic.obj) : error LNK2005: "protected: virtual void __thiscall boost::program_options::error_with_option_name::substitute_placeholders(class std::basic_string<char,struct std::char_traits,class std::allocator > const &)const " (?substitute_placeholders@error_with_option_name@program_options@boost@@MBEXABV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@@z) already defined in boost_program_options-vc110-mt-gd-1_53.lib(boost_program_options-vc110-mt-gd-1_53.dll)
libboost_program_options-vc110-mt-gd-1_53.lib(value_semantic.obj) : error LNK2005: "public: __thiscall boost::program_options::invalid_option_value::invalid_option_value(class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (??0invalid_option_value@program_options@boost@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@@z) already defined in boost_program_options-vc110-mt-gd-1_53.lib(boost_program_options-vc110-mt-gd-1_53.dll)
libboost_program_options-vc110-mt-gd-1_53.lib(value_semantic.obj) : error LNK2005: "private: virtual void __thiscall boost::program_options::value_semantic_codecvt_helper::parse(class boost::any &,class std::vector<class std::basic_string<char,struct std::char_traits,class std::allocator >,class std::allocator<class std::basic_string<char,struct std::char_traits,class std::allocator > > > const &,bool)const " (?parse@?$value_semantic_codecvt_helper@D@program_options@boost@@EBEXAAVany@3@ABV?$vector@V?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@v?$allocator@V?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@@2@@std@@_N@Z) already defined in boost_program_options-vc110-mt-gd-1_53.lib(boost_program_options-vc110-mt-gd-1_53.dll)
libboost_program_options-vc110-mt-gd-1_53.lib(value_semantic.obj) : error LNK2005: "void __cdecl boost::program_options::validate(class boost::any &,class std::vector<class std::basic_string<char,struct std::char_traits,class std::allocator >,class std::allocator<class std::basic_string<char,struct std::char_traits,class std::allocator > > > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > *,int)" (?validate@program_options@boost@@YAXAAVany@2@ABV?$vector@V?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@v?$allocator@V?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@@2@@std@@pav?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@5@H@Z) already defined in boost_program_options-vc110-mt-gd-1_53.lib(boost_program_options-vc110-mt-gd-1_53.dll)
libboost_program_options-vc110-mt-gd-1_53.lib(options_description.obj) : error LNK2005: "public: class boost::program_options::options_description_easy_init & __thiscall boost::program_options::options_description_easy_init::operator()(char const *,char const *)" (??Roptions_description_easy_init@program_options@boost@@QAEAAV012@PBD0@Z) already defined in boost_program_options-vc110-mt-gd-1_53.lib(boost_program_options-vc110-mt-gd-1_53.dll)
libboost_program_options-vc110-mt-gd-1_53.lib(options_description.obj) : error LNK2005: "public: class boost::program_options::options_description_easy_init & __thiscall boost::program_options::options_description_easy_init::operator()(char const *,class boost::program_options::value_semantic const *,char const *)" (??Roptions_description_easy_init@program_options@boost@@QAEAAV012@PBDPBVvalue_semantic@12@0@Z) already defined in boost_program_options-vc110-mt-gd-1_53.lib(boost_program_options-vc110-mt-gd-1_53.dll)
libboost_program_options-vc110-mt-gd-1_53.lib(options_description.obj) : error LNK2005: "public: __thiscall boost::program_options::options_description::options_description(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,unsigned int,unsigned int)" (??0options_description@program_options@boost@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@ii@Z) already defined in boost_program_options-vc110-mt-gd-1_53.lib(boost_program_options-vc110-mt-gd-1_53.dll)
libboost_program_options-vc110-mt-gd-1_53.lib(options_description.obj) : error LNK2005: "public: class boost::program_options::options_description_easy_init __thiscall boost::program_options::options_description::add_options(void)" (?add_options@options_description@program_options@boost@@QAE?AVoptions_description_easy_init@23@XZ) already defined in boost_program_options-vc110-mt-gd-1_53.lib(boost_program_options-vc110-mt-gd-1_53.dll)
libboost_program_options-vc110-mt-gd-1_53.lib(options_description.obj) : error LNK2005: "class std::basic_ostream<char,struct std::char_traits > & __cdecl boost::program_options::operator<<(class std::basic_ostream<char,struct std::char_traits > &,class boost::program_options::options_description const &)" (??6program_options@boost@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV23@ABVoptions_description@01@@z) already defined in boost_program_options-vc110-mt-gd-1_53.lib(boost_program_options-vc110-mt-gd-1_53.dll)
libboost_program_options-vc110-mt-gd-1_53.lib(convert.obj) : error LNK2005: "class std::basic_string<char,struct std::char_traits,class std::allocator > __cdecl boost::program_options::to_internal(class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?to_internal@program_options@boost@@ya?AV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@ABV34@@z) already defined in boost_program_options-vc110-mt-gd-1_53.lib(boost_program_options-vc110-mt-gd-1_53.dll)
C:\Users\dabd\Documents\poker\code\pokerstove-master\programs\build\pseval\Debug\pseval.exe : fatal error LNK1169: one or more multiply defined symbols found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Arguments for ps-eval are ignored

I compiled the latest master branch version e508a76 on Ubuntu 16.04, AMD64, and ran the following commands:
$ ./ps-eval AcAh
$ ./ps-eval --help
On both times the program first printed this:

The whole deck has 52 cards
There are 1326 two card combinations
There are 1 two card combinations

Then the program ran for ~8 minutes and finally printed:

A random hand has 40.0942 % equity (804780676 36223609 0 0)
The hand As6s has 59.9058 % equity (1220344506 36223609 0 0)

It looked like any arguments or no arguments would have had the same effect, although I didn't wait for the program to finish on other times.

Not working with CMake

Hi.
When porting PokerStove to Visual Studio 11 with CMake GUI I get the error message below. In CMakeLists.txt I use (with Boost 1.53.0):
set(BOOST_ROOT "C:/local/boost_1_53_0")
set(BOOST_LIBRARYDIR "C:/local/boost_1_53_0/lib32-msvc-10.0")

I double checked the library names. What am I missing?
Thanks...

Error message:

status: building for non-unix -> windows
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:1111 (message):
Unable to find the requested Boost libraries.

Boost version: 1.53.0

Boost include path: C:/local/boost_1_53_0

Could not find the following static Boost libraries:

      boost_program_options

No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the
directory containing Boost libraries or BOOST_ROOT to the location of
Boost.
Call Stack (most recent call first):
CMakeLists.txt:24 (find_package)

status** Boost Include: C:/local/boost_1_53_0
status** Boost Libraries:
status** Boost Libraries:

64 bit compatibility Issue

Hi Andrew,

When I run the following code in window/linux it produces different results.

set<CardSet> pockets = createCardSet(4, Card::SUIT_CANONICAL);

for (auto pit = pockets.begin(); pit != pockets.end(); pit++)
{
    cout << pit->str() << "\n";
}

On Linux this is the last cardset in the list

"AcAdAhAs"

On windows it's

"AcAd2c2c"

I've set the "TARGET_MACHINE" to x86 for penum, peval and ps-lut. (I modified main.cpp in ps-lut and added above code). I'm also definitely pointing to the lib32 version of boost.

I guess that one of the constants used as a mask is wrong somewhere? Or is there another setting I'm missing? I noticed that Windows doesn't recognise the -m32 and /m32 compiler/linker options.

I'll be working in linux from now on, but it might be worth flagging this up as an issue for other x64 users.

Thanks

Mark

ShowdownEnumerator: Break and return result after X iterations

Calculating the equity for multiple random hands takes a very long time.
If I'm not mistaken, the ShowdownEnumerator calculates all possible outcomes of hands, resulting in billions of calculations. It would be possible to limit the calculations to, say, 5% (and probably less than that) and get a result thats very close to the absolute result.
This would result in a major performance improvement.

Question: How can this functionality be implemented in ShowdownEnumerator?

Looks like ps-eval improperly divides the number of ties

I've noticed something strange:

$ ./ps-eval -hacas -hkhkd
The hand acas has 81.2555 % equity (1388072 3269 0 0)
The hand khkd has 18.7445 % equity (317694 3269 0 0)

The actual number of ties is 6538, but ps-eval reports it to be just half of that -- 3269.

Is this a bug or it's intended to work this way. If it's the later, shouldn't the "tie" number be renamed to something less misleading?

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.