Poker-AI.org
http://poker-ai.org/phpbb/

ProPokerTools syntax language and range creation
http://poker-ai.org/phpbb/viewtopic.php?f=26&t=2714
Page 1 of 1

Author:  JoeSham [ Thu Mar 06, 2014 1:31 am ]
Post subject:  ProPokerTools syntax language and range creation

Hi guys!
I just recently jumped into poker related programming (with just a little overall programming experience), so pardon my ignorance if my questions were already answered.

I decided to test my skills and create an omaha tool - evaluator, calculator, simulator, ... Basically working towards what PPT/Odds oracle is doing, minus a lot of things and plus some things. Not sure how far I will get obviously.

Right now I have a decent Omaha evaluator (originally based on the Keith Rule's library, but as it is now, most of the code is new, just often inspired or using same speed-ups etc.). After improving it over and over in the last couple days, I decided it is fast enough for now and I want to move on to other stuff.

So, what I want to do now is write parser code to translate submitted range strings into actual ranges. I want to start with ProPokerTools syntax (ie. AxKyxz:65+!TT or whatever) and hopefully improve it further in a similar manner to what PokerJuice uses (ie. 2p+, fd+, ...).

Atm I dont really know which way to go. I was thinking of trying to learn some language parser software, like Irony, but it seems like a lot of learning before I could use it well and I am not sure if I need something that robust. The other way is obviously to write my own simple parser, which is the way I started, but I am a bit lost tbh. Too many possible ways to do it and all of them seem quite difficult.

To simplify a couple more specific questions:
1. How to create ranges? Is it best to just compute all the hands that fit the criteria and store them in some big array? Or is it better to create ranges by combining range bit masks? Or some other way?
2. Am I better off writing my own parser or is this big enough task to rather learn to use Irony or some other robust parser?
3. How is PPT or PokerJuice code doing this?

Author:  spears [ Thu Mar 06, 2014 8:31 am ]
Post subject:  Re: ProPokerTools syntax language and range creation

There will probably be a spread of opinion as to whether this problem is big enough to use a parser tool. But writing your own parser is harder than it seems and using parser tools is a valuable skill that you might well use in future. I've used a few over the years and never regretted the time spent learning them. Beware though, not all tools can parse all languages, though you can usually fudge the language or change tool.

Don't know about the software you mentioned, but Openholdem uses the boost spirit parser library.

http://stackoverflow.com/questions/3241 ... he-grammar

Author:  Bliss [ Thu Mar 06, 2014 6:02 pm ]
Post subject:  Re: ProPokerTools syntax language and range creation

One of the jar's installed by PPT Odds Oracle is antlr.
Learning how to use a lexer/parser is definitely high up on my TODO list, I think a good start would be this course.

One thing to keep in mind that the learning curve for sth like antlr is, without doubt, much much harder than using a suboptimal approach like regex.

Author:  JoeSham [ Wed Mar 12, 2014 12:59 pm ]
Post subject:  Re: ProPokerTools syntax language and range creation

Update and new problem

So, I finally managed to write the code to parse range input (this was actually quite easy using the Irony parser, only problem was the lack of documentation; I will maybe write a very basic tutorial for others once I get a little more familiar with it) and generate ranges (v1 of the code is pretty slow, will have to work on this a lot more I guess).

So now I have a range (= an array of ulongs representing hands) for each player and I want to compute equities, monte carlo style.

The problem I have now is that I do not know how to randomly select hands from ranges in a way that doesnt skew the other random selections.
Like if I have ranges (AA) vs (AA,KK) and I first randomly select a hand from range (AA), then randomly select a hand from range (AA,KK), check if there is no card overlap and if there is, I repeat the selection. Now it matters which range is the first to select from. If range (AA) is first, then range (AA,KK) will have AA much less often than if if were first to select from.

Hope you guys can help me out here.
Joe

EDIT: Seems that I solved the problem. Now the algorithm draws all hands again (not just the last one) in a loop until there is no card overlap. I havent thought it through enough to be 100% sure its the correct solution, but so far what I tried it gives the same results as ProPokerTools.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/