andrewprock / pokerstove

poker evaluation and enumeration software
BSD 3-Clause "New" or "Revised" License
804 stars 350 forks source link

ps-eval hangs when no board present #68

Closed ncp1113 closed 4 years ago

ncp1113 commented 4 years ago

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 (debian-kernel@lists.debian.org) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 SMP Debian 4.19.67-2+deb10u2 (2019-11-11)

wesley-stone commented 4 years ago

I found that it actually did plenty of computation and finally outputs a strength of the given two cards.

ncp1113 commented 4 years ago

I am running it from the build/bin directory. I tried it on a MacBook Pro running Catalina and I got the same problem. The ps-eval I am using was downloaded on Feb 23. ./ps-eval AhTh hangs ./ps-eval AhTh --board AsTs9h The hand AhTh has 89.3639 % equity (953709 2654 0 0) A random hand has 10.6361 % equity (111173 2654 0 0)

wesley-stone commented 4 years ago

did you check the cpu usage?I ran on ubuntu16.04 and wait for a while and then it printed the rate

ncp1113 commented 4 years ago

It is using almost 100% of CPU. I will let it run in a separate terminal to see if it ever finishes. PS It did finish. So I wrote a little Python script to output how long it takes.

import time
import subprocess
hstr = "AhTh"
now = time.time()
stovecmd = '~/pokerstove/build/bin/ps-eval '+hstr
output = subprocess.check_output(stovecmd, shell=True)
done = time.time()
lines = output.decode().split('\n')
for l in lines:
    print(l)
print('Without board ps-eval took {:.2f} seconds'.format( done-now))
bstr = "TsAs9h"
now = time.time()
stovecmd = '~/pokerstove/build/bin/ps-eval '+hstr+' --board  '+bstr
output = subprocess.check_output(stovecmd, shell=True)
done = time.time()
lines = output.decode().split('\n')
for l in lines:
    print(l)
print('With board ps-eval took {:.2f} seconds'.format( done-now))

Here is the output: The hand AhTh has 64.6024 % equity (1331725962 23355873 0 0) A random hand has 35.3976 % equity (719134692 23355873 0 0)

Without board ps-eval took 182.82 seconds The hand AhTh has 89.3639 % equity (953709 2654 0 0) A random hand has 10.6361 % equity (111173 2654 0 0)

With board ps-eval took 0.10 seconds

wesley-stone commented 4 years ago

I think it is reasonable because when you do not give exact board configuration, the program will iterate for every possible public card combinations among the remaining cards.

ncp1113 commented 4 years ago

I see. I will mark this closed. Thanks for your insight.