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

Poker Software architecture
http://poker-ai.org/phpbb/viewtopic.php?f=26&t=2826
Page 1 of 1

Author:  S.Cooper [ Wed Oct 29, 2014 1:14 pm ]
Post subject:  Poker Software architecture

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.

Author:  spears [ Wed Oct 29, 2014 3:52 pm ]
Post subject:  Re: Poker Software architecture

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.

Author:  S.Cooper [ Wed Oct 29, 2014 6:20 pm ]
Post subject:  Re: Poker Software architecture

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?

Author:  spears [ Wed Oct 29, 2014 8:24 pm ]
Post subject:  Re: Poker Software architecture

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.

Author:  HontoNiBaka [ Fri Oct 31, 2014 5:41 am ]
Post subject:  Re: Poker Software architecture

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.

Author:  S.Cooper [ Wed Nov 05, 2014 11:38 am ]
Post subject:  Re: Poker Software architecture

HontoNiBaka wrote:
You could check our R Gibsons pure cfr code


Thanks

Author:  rtayek [ Sun Feb 22, 2015 7:43 am ]
Post subject:  Re: Poker Software architecture

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

Author:  rtayek [ Sat Feb 28, 2015 12:32 pm ]
Post subject:  Re: Poker Software architecture

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

Author:  spears [ Sat Feb 28, 2015 10:32 pm ]
Post subject:  Re: Poker Software architecture

meerkat, annual computer poker competition

Author:  rtayek [ Sat Feb 28, 2015 11:50 pm ]
Post subject:  Re: Poker Software architecture

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

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