Two Plus Two Newer Archives  

Go Back   Two Plus Two Newer Archives > Internet Gambling > Software
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #61  
Old 08-01-2007, 09:47 AM
Shoe Lace Shoe Lace is offline
Senior Member
 
Join Date: Sep 2004
Posts: 585
Default Re: Poker Hand XML

[ QUOTE ]
but I still think its missing some data and it isn't formatted right (element names cant be assigned values, i.e. <position="1" ...>

[/ QUOTE ]

Missing stats is no problem. That's the beauty of doing it like this. Adding an ante or straddle is trivial. Add them as attributes to the 'hand' node.

As for the other problem, that was my fault. [img]/images/graemlins/laugh.gif[/img]

The lines should look like:
<player position="1" action="Fold" value="0">

[ QUOTE ]
It is my opinion that each card is a seperate piece of data and should be parsed inidividually instead of making the reader do the extra work (which the read will have to do every time). So essentially this is just a space/human readability issue, right?

[/ QUOTE ]

I think as a developer I'd prefer them to share the same attribute separated by just a space.

This allows you to split the attribute and get back an array of cards regardless of how many exist.

You could also use the same exact routine to parse the community cards (again, the amount of cards do not matter).

This seems ideal for a project that's required to be as generic and future proof as possible.

Having them separated wouldn't cause worse performance really. Remember, just because a language has built in classes or has a way of supporting XML doesn't mean the code gets executed "invisibly". The CPU is still doing work.
Reply With Quote
  #62  
Old 08-01-2007, 09:52 AM
Tickner Tickner is offline
Senior Member
 
Join Date: Mar 2006
Posts: 3,554
Default Re: Poker Hand XML

alright, I will rework my example and try to condense it by adding more attributes instead of so many elements.
Reply With Quote
  #63  
Old 08-01-2007, 11:08 AM
Shoe Lace Shoe Lace is offline
Senior Member
 
Join Date: Sep 2004
Posts: 585
Default Re: Poker Hand XML

[ QUOTE ]

alright, I will rework my example and try to condense it by adding more attributes instead of so many elements.

[/ QUOTE ]

IMO it needs more than just replacing some elements as attributes. It's the flow/structure of the file that troubles me.
Reply With Quote
  #64  
Old 08-01-2007, 12:24 PM
bengele bengele is offline
Senior Member
 
Join Date: Dec 2004
Posts: 200
Default Re: Poker Hand XML

Tickner,

I kind of like what you have started here. A few things I would change:

1. I mentioned this one before but having constant values in mixed case ("PartyPoker", "TexasHoldem", "NoLimit", etc) always seemed error prone to me.
2. In your card element I think your player and pocket attributes are redundant. Doesn't having a value in player imply that it is a pocket card? I also think that card is an attribute of a player and not the other way around. Maybe you could move the player attribute to the cards element or something like that.
3. I am a little surprised everyone has a summary section. Does every site include this information in there hand histories?
4. What does your mucked cards section look like?

I wish we where taking more of an OO design philosophy to this. When I put together a schema I usually design my data types fist and decide what attributes belong with what data types. Then I take the data types and assemble them into what I want the instance document to look like. I find that I get a lot more reuse out of my data types when I do this and it makes changes easier as well.
Reply With Quote
  #65  
Old 08-01-2007, 03:44 PM
MuppetBingo MuppetBingo is offline
Member
 
Join Date: Apr 2007
Posts: 31
Default Re: Poker Hand XML

I've tried to build on some of the earlier suggestions in this thread. I am a Java programmer with about 8 years of experience and I see XML every day, though creating XSDs from scratch is on the fringe of my field.

But here's my submission for an example of a poker hand xml.

(the stuff in <!-- are comments, which relate to the element just below the comment)

<font class="small">Code:</font><hr /><pre>
&lt;?xml version="1.0"?&gt;
&lt;pokerhand id="11082740019" timestamp="2007-07-31T11:38:00-05:00"&gt;
&lt;context&gt;
&lt;location online="true"&gt;
&lt;room&gt;Absolute Poker&lt;/room&gt;
&lt;table id="562102981" name="Denmark Dr." seats="10"/&gt;
&lt;/location&gt;
&lt;!-- nolimit, potlimit or limit --&gt;
&lt;game type="texasholdem" format="tournament" bettingtype="nolimit"&gt;
&lt;!-- only use either tournament or cashgame tag --&gt;
&lt;tournament buyin="10" vig="1" id="56210298" currency="USD"/&gt;
&lt;cashgame maxbuyin="400" bigblind="2" currency=""/&gt;
&lt;/game&gt;
&lt;players&gt;
&lt;player id="MuppetBingo" stack="1500" seat="1" sittingout="false"/&gt;
&lt;player id="KermitIsGreen" stack="1500" seat="4" sittingout="false"/&gt;
&lt;player id="Animal" stack="1500" seat="5" sittingout="false"/&gt;
&lt;/players&gt;
&lt;/context&gt;
&lt;rounds&gt;
&lt;!-- antes is optional --&gt;
&lt;antes&gt;
&lt;ante playerId="MuppetBingo" amount="2"/&gt;
&lt;ante playerId="KermitIsGreen" amount="2"/&gt;
&lt;ante playerId="Animal" amount="2"/&gt;
&lt;/antes&gt;
&lt;!-- a round is a deal of cards followed by a sequence of player actions --&gt;
&lt;!-- possible round types are "preflop", "flop","turn", "river" --&gt;
&lt;round id="preflop"&gt;
&lt;!-- in 7 card stud deal will be a sequence of &lt;cards&gt; for each player, in texas-style games it will only contain 1 element --&gt;
&lt;deal&gt;
&lt;!-- open means whether the cards are visible to all. In stud there can be open non-community cards --&gt;
&lt;cards playerId="MuppetBingo" open="false" value="Ac Ad"/&gt;
&lt;/deal&gt;
&lt;!-- actions can be &lt;bet&gt; &lt;call&gt; , &lt;fold&gt; --&gt;
&lt;actions&gt;
&lt;!-- if omitted, forced is default "false" --&gt;
&lt;!-- bet type is optional, can be straddle, smallblind and bigblind --&gt;
&lt;bet playerId="MuppetBingo" forced="true" type="smallblind" amount="10"/&gt;
&lt;bet playerId="KermitIsGreen" forced="true" type="bigblind" amount="20"/&gt;
&lt;bet playerId="Animal" forced="false" type="straddle" amount="40"/&gt;
&lt;bet playerId="MuppetBingo" amount="10"/&gt;
&lt;bet playerId="KermitIsGreen" amount="30"/&gt;
&lt;call playerId="Animal" amount="30"/&gt;
&lt;call playerId="MuppetBIngo" amount="20"/&gt;
&lt;/actions&gt;
&lt;/round&gt;
&lt;round id="flop"&gt;
&lt;deal&gt;
&lt;!-- playerId is optional, and if not present it means the cards are community cards --&gt;
&lt;cards open="true" value="7c 2s Qh"/&gt;
&lt;/deal&gt;
&lt;actions&gt;
&lt;!-- call with amount = 0 is a check --&gt;
&lt;call playerId="MuppetBingo" amount="0"/&gt;
&lt;bet playerId="KermitIsGreen" amount="50"/&gt;
&lt;fold playerId="Animal"/&gt;
&lt;call playerId="MuppetBIngo" amount="50"/&gt;
&lt;/actions&gt;
&lt;/round&gt;
&lt;round id="turn"&gt;
&lt;deal&gt;
&lt;cards open="true" value="9h"/&gt;
&lt;/deal&gt;
&lt;actions&gt;
&lt;call playerId="MuppetBingo" amount="0"/&gt;
&lt;call playerId="KermitIsGreen" amount="0"/&gt;
&lt;/actions&gt;
&lt;/round&gt;
&lt;round id="river"&gt;
&lt;deal&gt;
&lt;cards open="true" value="Kc"/&gt;
&lt;/deal&gt;
&lt;actions&gt;
&lt;call playerId="MuppetBingo" amount="0"/&gt;
&lt;call playerId="KermitIsGreen" amount="0"/&gt;
&lt;/actions&gt;
&lt;/round&gt;
&lt;/rounds&gt;
&lt;result totalpot="280" rake="1.5"&gt;
&lt;hands&gt;
&lt;!-- mucked attribute is optional and has default value="false", cards is optional --&gt;
&lt;hand playerId="MuppetBingo" mucked="false" cards="Ac Ad"/&gt;
&lt;hand playerId="KermitIsGreen" mucked="false" cards="As Ks"/&gt;
&lt;hand playerId="Animal" mucked="true"/&gt;
&lt;/hands&gt;
&lt;pots&gt;
&lt;pot number="1" value="278.5"&gt;
&lt;winners&gt;
&lt;!-- for split pots, this will contain multiple winners --&gt;
&lt;winner playerId="MuppetBingo" amount="278.5" winningHand="Ac Ad Qh Kc 9h"/&gt;
&lt;/winners&gt;
&lt;/pot&gt;
&lt;/pots&gt;
&lt;/result&gt;
&lt;/pokerhand&gt;
</pre><hr />

1) If we are playing high-low poker we just split each pots into two, one for high and and one for low.
Reply With Quote
  #66  
Old 08-01-2007, 03:58 PM
MuppetBingo MuppetBingo is offline
Member
 
Join Date: Apr 2007
Posts: 31
Default Re: Poker Hand XML

We also need to handle player's cutting link midway.
Reply With Quote
  #67  
Old 08-01-2007, 04:27 PM
Tickner Tickner is offline
Senior Member
 
Join Date: Mar 2006
Posts: 3,554
Default Re: Poker Hand XML

Muppet,

Excellent structure. I have to run now late for a meeting but I will be focusing more on PokerHandXML tomorrow morning and we can get this thing close to finalzied!!

Keep up the good work guys and keep feeding us your opinions they are important.
Reply With Quote
  #68  
Old 08-01-2007, 04:28 PM
MuppetBingo MuppetBingo is offline
Member
 
Join Date: Apr 2007
Posts: 31
Default Re: Poker Hand XML

Hmm, the action-attributes need to be of the same type, ie. &lt;action&gt; instead of &lt;bet&gt; for it to be a proper sequence.

Here's version 1.1

<font class="small">Code:</font><hr /><pre>
&lt;?xml version="1.0"?&gt;
&lt;pokerhand id="11082740019" timestamp="2007-07-31 11:21:43"&gt;
&lt;context&gt;
&lt;location online="true"&gt;
&lt;room name="Absolute Poker" /&gt;
&lt;table id="562102981" name="Denmark Dr." seats="10"/&gt;
&lt;/location&gt;
&lt;!-- betting-types=nolimit, potlimit or limit --&gt;
&lt;game type="texasholdem" format="tournament" bettingtype="nolimit"&gt;
&lt;!-- only use either tournament or cashgame tag --&gt;
&lt;tournament buyin="10" vig="1" id="56210298" currency="USD"/&gt;
&lt;!-- we need both stakes and max buyin I guess? --&gt;
&lt;cashgame maxbuyin="400" bigblind="2" currency=""/&gt;
&lt;/game&gt;
&lt;players&gt;
&lt;player id="MuppetBingo" stack="1500" seat="1" sittingout="false"/&gt;
&lt;player id="KermitIsGreen" stack="1500" seat="4" sittingout="false"/&gt;
&lt;player id="Animal" stack="1500" seat="5" sittingout="false"/&gt;
&lt;/players&gt;
&lt;/context&gt;
&lt;rounds&gt;
&lt;!-- antes is optional, only includes as example. Normally we would not have antes in this hand --&gt;
&lt;antes&gt;
&lt;ante playerId="MuppetBingo" amount="2"/&gt;
&lt;ante playerId="KermitIsGreen" amount="2"/&gt;
&lt;ante playerId="Animal" amount="2"/&gt;
&lt;/antes&gt;
&lt;!-- a round is a deal of cards followed by a sequence of player actions --&gt;
&lt;!-- possible round types are "preflop", "flop","turn", "river" --&gt;
&lt;round id="preflop"&gt;
&lt;!-- in 7 card stud deal will be a sequence of &lt;cards&gt; for each player, in texas-style games it will only contain 1 element --&gt;
&lt;deal&gt;
&lt;!-- open means whether the cards are visible to all. In stud there can be open non-community cards --&gt;
&lt;cards playerId="MuppetBingo" open="false" value="Ac Ad"/&gt;
&lt;/deal&gt;
&lt;!-- actions can be &lt;bet&gt; &lt;call&gt; , &lt;fold&gt; --&gt;
&lt;actions&gt;
&lt;!-- amount is optional, --&gt;
&lt;!-- forced is optional and if omitted, will default to "false" --&gt;
&lt;!-- possible types=bet, call, check or fold. --&gt;
&lt;!-- name is optional, possible values = straddle, smallblind and bigblind --&gt;
&lt;action type="bet" playerId="MuppetBingo" forced="true" name="smallblind" amount="10"/&gt;
&lt;action type="bet" playerId="KermitIsGreen" forced="true" name="bigblind" amount="20"/&gt;
&lt;action type="bet" playerId="Animal" forced="false" name="straddle" amount="40"/&gt;
&lt;action type="bet" playerId="MuppetBingo" amount="10"/&gt;
&lt;action type="bet" playerId="KermitIsGreen" amount="30"/&gt;
&lt;action type="call" playerId="Animal" amount="30"/&gt;
&lt;action type="call" playerId="MuppetBIngo" amount="20"/&gt;
&lt;/actions&gt;
&lt;/round&gt;
&lt;round id="flop"&gt;
&lt;deal&gt;
&lt;!-- playerId is optional, and if not present it means the cards are community cards --&gt;
&lt;cards open="true" value="7c 2s Qh"/&gt;
&lt;/deal&gt;
&lt;actions&gt;
&lt;action type="check" playerId="MuppetBingo" /&gt;
&lt;action type="bet" playerId="KermitIsGreen" amount="50"/&gt;
&lt;action type="fold" playerId="Animal"/&gt;
&lt;action type="call" playerId="MuppetBIngo" amount="50"/&gt;
&lt;/actions&gt;
&lt;/round&gt;
&lt;round id="turn"&gt;
&lt;deal&gt;
&lt;cards open="true" value="9h"/&gt;
&lt;/deal&gt;
&lt;actions&gt;
&lt;action type="check" playerId="MuppetBingo"/&gt;
&lt;action type="check" playerId="KermitIsGreen"/&gt;
&lt;/actions&gt;
&lt;/round&gt;
&lt;round id="river"&gt;
&lt;deal&gt;
&lt;cards open="true" value="Kc"/&gt;
&lt;/deal&gt;
&lt;actions&gt;
&lt;action type="check" playerId="MuppetBingo" /&gt;
&lt;action type="check" playerId="KermitIsGreen" /&gt;
&lt;/actions&gt;
&lt;/round&gt;
&lt;/rounds&gt;
&lt;result&gt;
&lt;hands&gt;
&lt;!-- mucked attribute is optional and has default value="false", cards is optional --&gt;
&lt;hand playerId="MuppetBingo" mucked="false" cards="Ac Ad"/&gt;
&lt;hand playerId="KermitIsGreen" mucked="false" cards="As Ks"/&gt;
&lt;hand playerId="Animal" mucked="true"/&gt;
&lt;/hands&gt;
&lt;pots value="278.5" rake="1.5"&gt;
&lt;pot number="1" value="278.5"&gt;
&lt;winners&gt;
&lt;!-- for split pots, this will contain multiple winners --&gt;
&lt;winner playerId="MuppetBingo" amount="278.5" winningHand="Ac Ad Qh Kc 9h"/&gt;
&lt;/winners&gt;
&lt;/pot&gt;
&lt;/pots&gt;
&lt;/result&gt;
&lt;/pokerhand&gt;
</pre><hr />

* Changed the structure of &lt;result&gt; a bit, so that &lt;pots&gt; now holds the total value of all pots, with rake removed.
Reply With Quote
  #69  
Old 08-01-2007, 05:04 PM
Shoe Lace Shoe Lace is offline
Senior Member
 
Join Date: Sep 2004
Posts: 585
Default Re: Poker Hand XML

I do not understand why you have an ante section. Antes are forced action to whoever is dealt a hand at the table.

If 6 people are sitting at the table and the ante is 2 then each person is always going to put in 2. There is no reason to have this info posted for each player.

This info is automatically taken into account when getting their initial stack size.

ie. They would start with a 998 stack instead of 1000 (would require no code because their stack size is effected by the ante when they are dealt a hand).

The ante attribute is only needed to calculate the pot size and to let us know the table does have an ante present.
Reply With Quote
  #70  
Old 08-01-2007, 05:16 PM
TheIrishThug TheIrishThug is offline
Senior Member
 
Join Date: Jan 2005
Location: Belligerent and numerous
Posts: 1,819
Default Re: Poker Hand XML

You are right that you don't need to list all the players paying their ante. But it should be included to calculate each player's net for the hand. So you would have an explanation for why after three hands of folding pre-flop, my stack has gone from 1000 to 994.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:34 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.