Coder Social home page Coder Social logo

bupticybee / texasholdemsolverjava Goto Github PK

View Code? Open in Web Editor NEW
784.0 19.0 184.0 72.49 MB

A Java implemented Texas holdem and short deck Solver

License: MIT License

Java 90.69% Shell 0.16% Python 9.15%
texas-holdem texas-holdem-poker holdem-poker solver shortdeck piosolver

texasholdemsolverjava's Issues

init时内存溢出

initizing...
loading holdem compairer dictionary...
Exception in thread "Thread-1" java.lang.OutOfMemoryError: Java heap space
at java.util.Hashtable.(Unknown Source)
at java.util.Hashtable.(Unknown Source)
at icybee.solver.compairer.Dic5Compairer.load_compairer(Dic5Compairer.java:37)
at icybee.solver.compairer.Dic5Compairer.(Dic5Compairer.java:31)
at icybee.solver.SolverEnvironment.compairerFromConfig(SolverEnvironment.java:101)
at icybee.solver.gui.SolverGui.load_compairer(SolverGui.java:107)
at icybee.solver.gui.SolverGui.initize(SolverGui.java:229)
at icybee.solver.gui.SolverGui.access$000(SolverGui.java:23)
at icybee.solver.gui.SolverGui$1.run(SolverGui.java:303)

同学,您这个项目引入了13个开源组件,存在52个漏洞,辛苦升级一下

检测到 bupticybee/TexasHoldemSolverJava 一共引入了13个开源组件,存在52个漏洞

漏洞标题:SnakeYAML 安全漏洞
缺陷组件:org.yaml:[email protected]
漏洞编号:CVE-2017-18640
漏洞描述:SnakeYAML是一款基于Java的YAML解析器。
SnakeYAML 1.18版本中的Alias功能存在安全漏洞。攻击者可利用该漏洞造成拒绝服务。
国家漏洞库信息:https://www.cnvd.org.cn/flaw/show/CNVD-2020-22682
影响范围:(∞, 1.26)
最小修复版本:1.26
缺陷组件引入路径:icybee.riversolver:[email protected]>org.yaml:[email protected]

另外还有52个漏洞,详细报告:https://mofeisec.com/jr?p=icf692

`output_strategy.json` not generated?

Hey,
first, this is an awesome program!
Maybe this is more a question than an issue, in the description it says the output_strategy.json is generated after solving, but it is either not or I don't know where it is located.
I am using macOS, and I am happy to provide all the information you need.
Thanks

TexasHoldem solver can't solve for a Flop only scenario

My JVM is running out of memory when solving for a scenario that only provides community flop cards, no Turn or River card.

Steps to Reproduce:

Screen Shot 2021-04-05 at 9 45 57 PM

Settings used above.

Ranges I used for IP and OOP:

NateRange-IP.txt
NateRange-OOP.txt

I did some digging with my Debugger, and it appears that either

A) The call to ParallelCfrPlusSolver.setTrainable(GameTreeNode node) is entering into an infinite recursive call state

or

B) The same call from above is not handling memory management between threads properly or creating two many threads.

Stack Trace from GUI application:

java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedConstructorAccessor2.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at icybee.solver.solver.ParallelCfrPlusSolver.setTrainable(ParallelCfrPlusSolver.java:173) at icybee.solver.solver.ParallelCfrPlusSolver.setTrainable(ParallelCfrPlusSolver.java:176) at icybee.solver.solver.ParallelCfrPlusSolver.setTrainable(ParallelCfrPlusSolver.java:176) at icybee.solver.solver.ParallelCfrPlusSolver.setTrainable(ParallelCfrPlusSolver.java:180) at icybee.solver.solver.ParallelCfrPlusSolver.setTrainable(ParallelCfrPlusSolver.java:176) at icybee.solver.solver.ParallelCfrPlusSolver.setTrainable(ParallelCfrPlusSolver.java:176) at icybee.solver.solver.ParallelCfrPlusSolver.setTrainable(ParallelCfrPlusSolver.java:180) at icybee.solver.solver.ParallelCfrPlusSolver.setTrainable(ParallelCfrPlusSolver.java:176) at icybee.solver.solver.ParallelCfrPlusSolver.setTrainable(ParallelCfrPlusSolver.java:176) at icybee.solver.solver.ParallelCfrPlusSolver.train(ParallelCfrPlusSolver.java:206) at icybee.solver.gui.SolverGui.solve(SolverGui.java:281) at icybee.solver.gui.SolverGui.access$200(SolverGui.java:23) at icybee.solver.gui.SolverGui$3$1.run(SolverGui.java:328) Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded at icybee.solver.trainable.DiscountedCfrTrainable.<init>(DiscountedCfrTrainable.java:78) ... 16 more

Solver Results

So from my understanding, after the solver completes a solve, it writes the results to a file. This file is then interpreted by some SolverResult class.

So my question is, is there any way to save these files and then re-import them into the SolverResult GUI to view the already solved scenario without re-running the sim?

Also where are these result files saved? Are they saved somewhere in the test/ directory?

Thanks for all your work.

java.lang.OutOfMemoryError: Java heap space

When running python3 java_interface.py after installation, I first get this warning:

java_interface.py:15: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.

Then after running a short while, I get an error. This is the complete output:

self.conf = yaml.load(fhdl)
Dic5Comapirer Load 99% │███████████████▉│ 376900/376993 (0:00:01 / 0:00:00)
Dic5Comapirer Load 99% │█████████████▉│ 2598900/2598961 (0:00:06 / 0:00:00)
Using 4 threads
Iter: 0
player 0 exploitability 2.072703
player 1 exploitability 1.734039
Total exploitability 47.584270 precent
time used: 0.03s

Iter: 1
player 0 exploitability 1.926970
player 1 exploitability 1.836820
Total exploitability 47.047371 precent
time used: 0.22s

Iter: 11
player 0 exploitability 0.293004
player 1 exploitability 0.095000
Total exploitability 4.850047 precent
time used: 0.28s

Iter: 21
player 0 exploitability 0.199628
player 1 exploitability -0.059344
Total exploitability 1.753547 precent
time used: 0.32s

Iter: 31
player 0 exploitability 0.156179
player 1 exploitability -0.100702
Total exploitability 0.693454 precent
time used: 0.36s

Iter: 41
player 0 exploitability 0.154044
player 1 exploitability -0.107528
Total exploitability 0.581459 precent
++++++++++++++++
solve finish, total time used: 0.37s
.Using 4 threads
Iter: 0
player 0 exploitability 1.653075
player 1 exploitability 2.146374
Total exploitability 47.493111 precent
time used: 0.01s

Iter: 1
player 0 exploitability 0.937044
player 1 exploitability 2.743413
Total exploitability 46.005707 precent
time used: 0.02s

Iter: 11
player 0 exploitability 0.040586
player 1 exploitability 0.322102
Total exploitability 4.533607 precent
time used: 0.02s

Iter: 21
player 0 exploitability -0.073854
player 1 exploitability 0.189015
Total exploitability 1.439512 precent
time used: 0.03s

Iter: 31
player 0 exploitability -0.105610
player 1 exploitability 0.163405
Total exploitability 0.722437 precent
time used: 0.03s

Iter: 41
player 0 exploitability -0.114473
player 1 exploitability 0.168947
Total exploitability 0.680923 precent
++++++++++++++++
solve finish, total time used: 0.04s
.Using 4 threads
Iter: 0
player 0 exploitability 2.218541
player 1 exploitability 2.348576
Total exploitability 57.088959 precent
time used: 0.46s

Iter: 1
player 0 exploitability 1.201122
player 1 exploitability 0.877050
Total exploitability 25.977146 precent
time used: 1.07s

Iter: 11
player 0 exploitability 0.407176
player 1 exploitability 0.191614
Total exploitability 7.484877 precent
time used: 1.98s

Iter: 21
player 0 exploitability 0.245336
player 1 exploitability -0.016597
Total exploitability 2.859249 precent
time used: 2.53s

Iter: 31
player 0 exploitability 0.185452
player 1 exploitability -0.078987
Total exploitability 1.330806 precent
time used: 3.11s

Iter: 41
player 0 exploitability 0.160364
player 1 exploitability -0.102730
Total exploitability 0.720429 precent
++++++++++++++++
solve finish, total time used: 3.60s
.Using 4 threads
Iter: 0
player 0 exploitability 2.659898
player 1 exploitability 2.561559
Total exploitability 65.268211 precent
time used: 0.31s

Iter: 1
player 0 exploitability 1.198172
player 1 exploitability 1.700879
Total exploitability 36.238136 precent
time used: 5.66s

Iter: 11
player 0 exploitability 0.226130
player 1 exploitability 0.114687
Total exploitability 4.260209 precent
time used: 11.17s

Iter: 21
player 0 exploitability 0.123826
player 1 exploitability 0.002493
Total exploitability 1.578979 precent
time used: 16.36s

Iter: 31
player 0 exploitability 0.085367
player 1 exploitability -0.040322
Total exploitability 0.563062 precent
time used: 21.89s

Iter: 41
player 0 exploitability 0.073824
player 1 exploitability -0.053925
Total exploitability 0.248744 precent
++++++++++++++++
solve finish, total time used: 26.59s
EUsing 4 threads
Iter: 0
player 0 exploitability 2.073847
player 1 exploitability 1.735141
Total exploitability 47.612354 precent
time used: 0.00s

Iter: 1
player 0 exploitability 1.893381
player 1 exploitability 1.837019
Total exploitability 46.630009 precent
time used: 0.02s

Iter: 11
player 0 exploitability 0.318011
player 1 exploitability 0.093080
Total exploitability 5.138637 precent
time used: 0.03s

Iter: 21
player 0 exploitability 0.200266
player 1 exploitability -0.065872
Total exploitability 1.679916 precent
time used: 0.04s

Iter: 31
player 0 exploitability 0.154990
player 1 exploitability -0.101124
Total exploitability 0.673333 precent
time used: 0.06s

Iter: 41
player 0 exploitability 0.143440
player 1 exploitability -0.111861
Total exploitability 0.394738 precent
++++++++++++++++
solve finish, total time used: 0.07s
.Using 4 threads
Iter: 0
player 0 exploitability 2.150103
player 1 exploitability 2.279707
Total exploitability 55.372631 precent
time used: 0.05s

Iter: 1
player 0 exploitability 1.012547
player 1 exploitability 0.686820
Total exploitability 21.242090 precent
time used: 0.55s

Iter: 11
player 0 exploitability 0.333881
player 1 exploitability 0.150937
Total exploitability 6.060219 precent
time used: 0.90s

Iter: 21
player 0 exploitability 0.190800
player 1 exploitability -0.014762
Total exploitability 2.200477 precent
time used: 1.25s

Iter: 31
player 0 exploitability 0.150024
player 1 exploitability -0.068069
Total exploitability 1.024435 precent
time used: 1.59s

Iter: 41
player 0 exploitability 0.130023
player 1 exploitability -0.085438
Total exploitability 0.557310 precent
++++++++++++++++
solve finish, total time used: 1.91s
.

ERROR: test_shortdeck_flop (main.TestSolver)

Traceback (most recent call last):
File "PokerSolver.java", line 139, in icybee.solver.runtime.PokerSolver.train
File "GameTree.java", line 902, in icybee.solver.GameTree.dumps
File "GameTree.java", line 856, in icybee.solver.GameTree.reConvertJson
File "GameTree.java", line 856, in icybee.solver.GameTree.reConvertJson
File "GameTree.java", line 856, in icybee.solver.GameTree.reConvertJson
File "GameTree.java", line 888, in icybee.solver.GameTree.reConvertJson
File "GameTree.java", line 865, in icybee.solver.GameTree.reConvertJson
File "DiscountedCfrTrainable.java", line 198, in icybee.solver.trainable.DiscountedCfrTrainable.dumps
File "String.java", line 2897, in java.lang.String.format
File "Formatter.java", line 2509, in java.util.Formatter.toString
File "StringBuilder.java", line 448, in java.lang.StringBuilder.toString
File "StringLatin1.java", line 715, in java.lang.StringLatin1.newString
Exception: Java Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "java_interface.py", line 62, in test_shortdeck_flop
result_json = self.ps_shortdeck.train(
java.lang.java.lang.OutOfMemoryError: java.lang.OutOfMemoryError: Java heap space


Ran 6 tests in 94.208s

打开程序后log报错

log提示下面报错是什么原因呢?(jre已经是11.0.2)
Exception in thread "Thread-0" java.lang.RuntimeException: load config failed: cannot find config file
at icybee.solver.gui.SolverGui.loadConfig(SolverGui.java:100)
at icybee.solver.gui.SolverGui.load_compairer(SolverGui.java:106)
at icybee.solver.gui.SolverGui.initize(SolverGui.java:229)
at icybee.solver.gui.SolverGui.access$000(SolverGui.java:23)
at icybee.solver.gui.SolverGui$1.run(SolverGui.java:303)

The base algorithm introduction

Hi,
You did a great job on this topic.
But about your algorithm, I am still confused about every step.
Are there any introductions about this algorithm for texas pokers?

For example, I am unsure how to combine the cards and actions during the iterations.

Thanks for your help.

下载后安装问题

捕获1
捕获2
捕获3

首先声明没有编程常识,电脑是win10。按照简介,下载对应的java.exe并安装了。win+R cmd 输入java,应该算安装成功了(图1)。
然后运行了RiverSolver.jar,发现打不开手牌范围的图,只是旁边出了几排提示文字(看不懂)。以及board牌面打开设置时只显示到8(很可惜没有留下截图)。

我以为是java配置什么问题,又搜了相关文章,什么建立jdk文件夹,搞了环境变量等等。
最后发现软件也打不开了,然后删了重装java等等,再把环境变量改回来(也不知道是否改回原来的样子了)。
目前的状况如图2和图3吧,打开时选择安装目录下的javaw.exe也是没有反应。

压缩包解压后直接运行jar,点击按钮报错

按照哔哩哔哩视频中解压了zip,但是直接运行jar点击按钮报错了,我的电脑是Mac,jdk是8,这个和jdk版本有关系吗,但是我在idea中启动项目(依旧是jdk8)点击按钮都没问题

How to run solver?

Hey, there seems to be a lot of newer files uploaded than it was in the tutorial video/README, would it be possible to get an update on how to run the newer files? Thanks so much! For example, java_interface.py is no longer available.

How to deal with multiple players?

Thanks for sharing the great work!

I wonder if current solvers can be applied to multiple people (e.g. 3-way pot), or are there any techniques related to it?

Terminating with uncaught exception of type NSException

偶尔在点击范围选择按钮时候会闪退(重试依然闪退),错误报告在下面。
点结果按钮也一样,似乎和打开新窗口有关。

Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGABRT)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000103333008
Exception Note: EXC_CORPSE_NOTIFY
VM Regions Near 0x103333008:
__LINKEDIT 10332b000-103333000 [ 32K] r--/rwx SM=COW /Library/Java/JavaVirtualMachines/jdk-11.0.12.jdk/Contents/Home/lib/libjimage.dylib
--> VM_ALLOCATE 103333000-103334000 [ 4K] ---/rwx SM=NUL
VM_ALLOCATE 103334000-103335000 [ 4K] r--/rwx SM=PRV

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[AWTView keyboardInputSourceChanged:]: unrecognized selector sent to class 0x10e6513b8'
abort() called
terminating with uncaught exception of type NSException

Raise "java.lang.RuntimeException: java.lang.RuntimeException" when build game tree

系统: windows 10
java version: 11.0.10
code as following:

`
from jpype import *
import yaml
import numpy as np
import sys
import os
resdir = "D:/poker/RiverSolver/RiverSolver/resources"
sys.path.append(resdir)
from python.TreeBuilder import *
import unittest
import pdb

cdir = "D:/poker/RiverSolver/RiverSolver"
path = cdir + "/RiverSolver.jar"
res = startJVM(getDefaultJVMPath(), "-ea", "-Djava.class.path=%s" % path)
os.chdir(cdir)

PokerSolver = JClass('icybee.solver.runtime.PokerSolver')

def test():
with open('./resources/yamls/general_rule.yaml') as fhdl:
conf = yaml.load(fhdl)
ps_holdem = PokerSolver("Dic5Compairer",
"./resources/compairer/card5_dic_sorted.txt",
2598961,
['A', 'K', 'Q', 'J', 'T', '9', '8', '7', '6', '5', '4', '3', '2'],
['h', 's', 'd', 'c']
)
rule = RulesBuilder(
conf,
current_commit = [2,2],
current_round = 4,
raise_limit = 1,
check_limit = 2,
small_blind = 0.5,
big_blind = 1,
stack = 10,
bet_sizes = ["0.5_pot","1_pot","2_pot","all-in"],
)
gameTree = PartGameTreeBuilder(rule)
depth = np.inf
json = gameTree.gen_km_json("./tree.km".format(depth), limit=depth, ret_json=True)

print("to build game tree in test holdem river")
ps_holdem.build_game_tree("./tree.km")

if name == 'main':
test()
`

报错信息如下:
D:\Mogu\venv\Scripts\python.exe D:/poker/RiverSolver/RiverSolver/resources/python/java_interface.py
D:/poker/RiverSolver/RiverSolver/resources/python/java_interface.py:297: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
conf = yaml.load(fhdl)
Dic5Comapirer Load 99% ��
to build game tree in test holdem river
Traceback (most recent call last):
File "PokerSolver.java", line 46, in icybee.solver.runtime.PokerSolver.build_game_tree
File "SolverEnvironment.java", line 77, in icybee.solver.SolverEnvironment.gameTreeFromJson
Exception: Java Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "D:/poker/RiverSolver/RiverSolver/resources/python/java_interface.py", line 326, in
test()
File "D:/poker/RiverSolver/RiverSolver/resources/python/java_interface.py", line 320, in test
ps_holdem.build_game_tree("./tree.km")
java.lang.RuntimeException: java.lang.RuntimeException

run release project error, load config failed

按照文档给出的链接安装了 java re

release包版本为 TexasHoldemSolverJava 0.2.0

下载后启动 jar 包,log窗口出现以下报错

initizing...
loading holdem compairer dictionary...
Exception in thread "Thread-0" java.lang.RuntimeException: load config failed: cannot find config file
	at icybee.solver.gui.SolverGui.loadConfig(SolverGui.java:100)
	at icybee.solver.gui.SolverGui.load_compairer(SolverGui.java:106)
	at icybee.solver.gui.SolverGui.initize(SolverGui.java:229)
	at icybee.solver.gui.SolverGui.access$000(SolverGui.java:23)
	at icybee.solver.gui.SolverGui$1.run(SolverGui.java:303)

本地 Java 版本为

java --version
openjdk 11.0.10 2021-01-19
OpenJDK Runtime Environment (build 11.0.10+9)
OpenJDK 64-Bit Server VM (build 11.0.10+9, mixed mode)

是需要进行什么配置文件进行配置吗?

【打开报错求助】

按照步骤安装了JRE和release包,运行时报错,调至全英文目录后仍然报错……
image
image

Exception in thread "Thread-0" java.lang.RuntimeException: load config failed: cannot find config file

initizing...
loading holdem compairer dictionary...
Exception in thread "Thread-0" java.lang.RuntimeException: load config failed: cannot find config file
at icybee.solver.gui.SolverGui.loadConfig(SolverGui.java:100)
at icybee.solver.gui.SolverGui.load_compairer(SolverGui.java:106)
at icybee.solver.gui.SolverGui.initize(SolverGui.java:229)
at icybee.solver.gui.SolverGui.access$000(SolverGui.java:23)
at icybee.solver.gui.SolverGui$1.run(SolverGui.java:303)

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.