Poker-AI.org

Poker AI and Botting Discussion Forum
It is currently Wed Jul 17, 2019 5:08 am

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Wed Oct 29, 2014 1:14 pm 
Offline
New Member

Joined: Wed Apr 09, 2014 1:23 pm
Posts: 6
The idea

I started to write classes for poker. The goal is to make them as flexible as possible, so i could use them for multiple purposes:
-SNGWizard alike advisor for push or fold situations
-pokerrom to play against friends
-simulate toy games like Kuhn poker
-hand replayer
-can be you with different poker types (SNG, cash game) and variants (PLO, NLHE )

What i have so far
Image
i have to do next
-introduce PHASE (post, preflop, flop, turn river, showdown)
Short terms next goals
-Deck class (for shuffling), toy games dont need 52 card deck
-Range class: makes fancy annotation (Axs, 22-55, AJs+,Ts2s) to a list of hands, card removal

Some questions:
-as you can see i have the class HandState (maybe GameNode is more common name for it). The idea was that every action (bet, fold etc) generates a new handstates, which belong to a hand. If a player acts, a new handstate will be created. They can be also a representation of possible ways to play a hand (game tree). Do you think its a good idea? How do you store the "hand history" (squence of actions so far), and generate the theoretical ones (possible states in the future)?

-A Player has to know which legal action are available if he is to act. There are different rules in NL and FL, not to mention toy games, or forced strategies (push or fold). How do you represent poker rules in your bot?

Please feel free to comment, criticize. If you see something, what you would write/stucture another way, please let me know.


Top
 Profile  
 
PostPosted: Wed Oct 29, 2014 3:52 pm 
Offline
Site Admin
User avatar

Joined: Sun Feb 24, 2013 9:39 pm
Posts: 575
While I have found software engineering approaches like this useful in my day job, I could never find a flexible (or fast) enough core representation for poker problems so I reinvent the class structure anew every iteration.

If I had my time again I would probably represent poker rules as a state machine.


Top
 Profile  
 
PostPosted: Wed Oct 29, 2014 6:20 pm 
Offline
New Member

Joined: Wed Apr 09, 2014 1:23 pm
Posts: 6
Thank you for your comment
spears wrote:
f I had my time again I would probably represent poker rules as a state machine.


Could you please elaborate, how would you do it?


Top
 Profile  
 
PostPosted: Wed Oct 29, 2014 8:24 pm 
Offline
Site Admin
User avatar

Joined: Sun Feb 24, 2013 9:39 pm
Posts: 575
Without actually doing it I'm not sure I can elaborate. But it strikes me that a state chart might be a good way to represent game rules, and I'm reasonably sure I can generate code from a chart, or represent a chart in code. Here are some examples of state charts that include part of a game of bridge http://www.cs.toronto.edu/~jm/340S/PDF2/StateD.pdf

Generating a game tree amounts to "running" the state machine through all its possible states.

see also http://en.wikipedia.org/wiki/UML_state_machine
Quote:
The concept of a FSM is important in event-driven programming because it makes the event handling explicitly dependent on both the event-type and on the state of the system. When used correctly, a state machine can drastically cut down the number of execution paths through the code, simplify the conditions tested at each branching point, and simplify the switching between different modes of execution. Conversely, using event-driven programming without an underlying FSM model can lead programmers to produce error prone, difficult to extend and excessively complex application code.


Top
 Profile  
 
PostPosted: Fri Oct 31, 2014 5:41 am 
Offline
Senior Member

Joined: Wed Mar 20, 2013 1:43 am
Posts: 235
You could check our R Gibsons pure cfr code, it has a decent representation of a poker game, even if it might not be 100% what you want to do, it should give some good ideas.


Top
 Profile  
 
PostPosted: Wed Nov 05, 2014 11:38 am 
Offline
New Member

Joined: Wed Apr 09, 2014 1:23 pm
Posts: 6
HontoNiBaka wrote:
You could check our R Gibsons pure cfr code


Thanks


Top
 Profile  
 
PostPosted: Sun Feb 22, 2015 7:43 am 
Offline
Junior Member

Joined: Sun Feb 22, 2015 6:29 am
Posts: 11
Location: 90712
S.Cooper wrote:
The idea ... I started to write classes for poker. The goal is to make them as flexible as possible, so i could use them for multiple purposes: ...


i have some very basic classes from earlier work. here is what i have so far.

classes
Rank - enum instances of each rank
Suit - enum instances of each suit
Card(Rank,Suit) - enum instances of each of th 52 cards and a joker.
Cards - array of Card
Deck - subclass of Cards
Hand - subclass of Cards
HoldemHand - enum instances of all 169 holdem hands
Range - holdem hand range like 88+, A8s+, AT+
SpecificHoldemHand - a pair of Card - like AdQh
methods
function lookup(5 cards) - returns hand number (hand number 1 is 5 aces)

you can see some sample code at http://stackoverflow.com/questions/9554872/how-to-operate-the-poker-game-by-java/9608351#9608351

these would just be the building blocks for what you are doing.

thanks


Top
 Profile  
 
PostPosted: Sat Feb 28, 2015 12:32 pm 
Offline
Junior Member

Joined: Sun Feb 22, 2015 6:29 am
Posts: 11
Location: 90712
rtayek wrote:
S.Cooper wrote:
The idea ... I started to write classes for poker. The goal is to make them as flexible as possible, so i could use them for multiple purposes: ...


i have some very basic classes from earlier work. here is what i have so far. ...


i am starting to write a game server.

what kind of api would a bot like?

are there some example api's that i can look at?

thanks


Top
 Profile  
 
PostPosted: Sat Feb 28, 2015 10:32 pm 
Offline
Site Admin
User avatar

Joined: Sun Feb 24, 2013 9:39 pm
Posts: 575
meerkat, annual computer poker competition


Top
 Profile  
 
PostPosted: Sat Feb 28, 2015 11:50 pm 
Offline
Junior Member

Joined: Sun Feb 22, 2015 6:29 am
Posts: 11
Location: 90712
spears wrote:
meerkat, annual computer poker competition


found Meerkat-API-2.5 at http://www.poker-academy.com/community.php

looks like someone bought http://www.poker-academy.com/

thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron
Powered by phpBB® Forum Software © phpBB Group