Thread: "Poker" AI competition

  1. #16
    Registered User jdragyn's Avatar
    Join Date
    Sep 2009
    Posts
    96
    Quote Originally Posted by EVOEx View Post
    I agree with jdragyn, using a float in stead of a real hand removes the interesting features of poker. It makes a lot of intelligent decisions completely worthless. Also, never knowing what the other players had makes it completely worthless.
    Why not make a real poker AI? It's not that difficult to code the framework.
    Actually, I quite like the idea of using a float to represent the "hand". It quantifies the hand in a simple way so the focus can shift to betting, which in my opinion is what poker is really about. You can't play poker without some form of wagering, even if it is pennies, poker chips or pretzels.

    My primary reservation for the given format is the lack of information.
    • If I fold, will my AI function still be called, even though game_info.has_folded[my_id] is true? If not, I will lose all further information for the hand.
    • Even if I stay in to the end, if I am the first to raise and some players call, others fold, but no one raises, will it ever come back to me so I can poll the struct to see who stayed and who folded? If not I have no way to tell what the effects of my action were.
    • If I call someone's big bet, I need to see what they had. Was their hand (number) really bigger than mine or were they bluffing? Or did they just overvalue their hand?

    My secondary reservation, which is not quite as much of a problem, is the format.
    • Except for some really old variations of poker (which I wasn't aware of until I did some wiki research), a hand of poker contains one or more changes, each accompanied by a round of betting.
      • Hold'em and Omaha have pre-flop, flop, turn and river
      • 7-card stud and Razz have 5 "streets", some face up, some face down
      • Draw has one or more draws before showdown (triple draw has 3 draws for example).
    • These changes allow the players to gather more information, both during the hand and over the course of several hands. They also allow more complex patterns of betting.


    I say the format is not quite as much of a problem because even a simple version of Draw poker allows a large amount of variation in play. Such complexity might be beyond the scope of a module crafted in only a couple weeks. If the format were to be expanded to include some change during a hand, the value of a hand could easily be kept as a float:
    Code:
    "Deal" the starting hand (random value between 0 and 1 for each player)
    Blind betting round (big blind forced bet and responses from everyone)
    Emulate a "flop" or a "draw" by adding a random value between 0 and 1 to each player's existing hand
    Normal betting round (players may check)
    Showdown - highest hand (which is now between 0 and 2) wins
    I would like to submit an entry even if things stay as-is, though I would like the questions in my other post answered so I know what assumptions I can make from hand to hand.

    Quote Originally Posted by MK27
    Since very little knowledge of poker is required here, can someone explain this part?

    6) Regular Hold'em rules apply for all-in
    Given:
    • Player A has $20
    • Player B has $50
    • Player C has $75
    • Player A goes all-in (bets his entire $20)

    Scenario 1: Players B and C can simply call. The pot now has $60 ($20 from each player). Whoever has the best hand wins the entire pot.

    Scenario 2: Player B raises to $50 and Player C calls. $20 of Player B's bet goes to the main pot to match Player A's $20, and the other $30 is placed in a side pot. Player C calls, so $20 more goes into the main pot for a total of $60 and $30 more goes into the side pot to match B's $30. First the side pot goes to B or C, whichever has the better hand, because only B and C contributed to that pot. Next, the main pot goes to the better hand of A, B or C because all 3 contributed to the main pot.

    Scenario 3: Player B raises to $50 and Player C re-raises to $75. Exactly like Scenario 2, except the extra $25 that Player C raised would go into a second side-pot. If there are only these three players, Player C gets that $25 back no matter what because only C contributed to the second side pot (he most definitely has the best hand amongst himself).

    Scenario 3a: If we add Player D with $100 and he calls the $75, the main pot now has $80 ($20 from each), the first side pot has $90 ($30 each from B, C and D), and the second side pot has $50 ($25 each from C and D). The second side pot of $50 would go to the better hand of C or D because they contributed to it. The first side pot of $90 would then go to B, C or D because they contributed to it. And then the main pot of $80 would go to A, B, C or D.

    Quote Originally Posted by SlyMaelstrom
    I don't know what "regular" Hold'em rules are... but I'd imagine he's trying to say "No Limit" (even though in casinos a limit is more common).
    Actually, all of the popular formats that I am aware of have the same type of All-in rules that I described above. The format Sang-drax is proposing would be considered No Limit, so a player can bet up to their entire stack on any betting round, vs. Limit where there is a limit to how much can be bet, and usually it is a fixed number.

    A $5 limit game means if you want to bet, you must bet $5. If you want to raise, you can raise by $5. If it comes around to you to call, your call will be in an increment of $5. If you want to raise but only have $4 left, you would be considered all-in. Everyone who calls your raise would be calling $5, with $1 from each going to a side pot.

    There is also Pot-Limit, which is similar to no-limit (you can bet any amount rather than in steps), but your bet can not be larger than what is currently in the pot (including bets from the current betting round). This betting variation usually limits the betting early in the hand and keeps things a little more conservative.
    Last edited by jdragyn; 03-12-2010 at 01:22 AM. Reason: Responding to SlyMaelstrom
    C+/- programmer extraordinaire

  2. #17
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    can i just have the exact (as far as they are currently agreed ) rules for this contest i would like to give it a go, people have already submitted entires so i think unless that one is withdrawn then we should all submit programs based on the criteria of that entry...?

  3. #18
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    Unfortunately Sang-drax hasn't been active here in two weeks, so who knows what his response will be to the suggestions.

    I might just try to do a simple AI based on what we have here and then modify it if he updates anything. I've been waiting to hear back up until now.

  4. #19
    Registered User jdragyn's Avatar
    Join Date
    Sep 2009
    Posts
    96
    I've completed an entry based on the original post information (despite all my suggestions and comments...), just want to wait and see if Sang-drax makes any changes before I send it in.
    C+/- programmer extraordinaire

  5. #20
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    I'm still stuck trying to get the test harness working correctly. I have to come up with a way to handle side pots, not doing so was screwing up my test runs.

  6. #21
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Quote Originally Posted by Daved View Post
    Unfortunately Sang-drax hasn't been active here in two weeks, so who knows what his response will be to the suggestions.
    Yes, I apologize for that. I have been traveling.

    It is correct that I meant no-limit hold'em. Hopefully that was clear since all-in was mentioned. There is no pot-limit.

    As pointed out, there is no interface for actually knowing how the hands end. If that is desired, I could add an interface for that. I tried to keep things simple, in order to encourage people to actually submit something. How would you like the interface?
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  7. #22
    Registered User jdragyn's Avatar
    Join Date
    Sep 2009
    Posts
    96
    Business travel or personal? Either way, hope your travels were interesting.

    The interface doesn't really need to change. So long as we have access to the struct, and it is updated appropriately, we can deduce any information we need. I kind of see that as part of the challenge now.

    I do have a couple suggestions if you want to go ahead and provide some additional info at the end of a hand:

    Add a bool member to GameInfo, called end_of_hand. If this value is false, the framework is expecting a bet. If this value is true, the framework will ignore the return value; it is simply exposing the struct for us to update after the hand. Alternatively, pass the hand value as a negative value to indicate the end of hand update call.

    Add a float member to GameInfo, called high_hand. If end_of_hand is true, then high_hand will expose the hand value that won the hand or ALL_FOLDED to indicate the hand winner didn't have to show because everyone else folded. If end_of_hand is false then high_hand will be IN_PROGRESS or something.

    Add an int member to GameInfo, called hand_winner. If end_of_hand is true then hand_winner will expose the player id of which player had the high_hand. Otherwise it could be NO_WINNER.

    An easy way to implement this is, after the betting is complete, determine the winner, update the GameInfo struct with the hand_winner and high_hand values, set end_of_hand = true and then call each AI regardless of whether they folded or showed-down.

    The only problem with this method would be if there are side-pots and/or split pots. In that case though, high_hand could be a pointer. high_hand[0] would be the hand that won the main pot; high_hand[1] would be the hand that won the first side pot, etc. Likewise , hand_winner could also be a pointer with winner of the main pot being hand_winner[0] and so on. The only addition this would require would be a count of how many pots were formed during the hand. This will add a bit of complexity to the framework, but it would allow our AI to capture more complete info about a hand if it so chooses.

    Or just leave it as-is and we'll see who can write a "better" AI with the limited info. I'll be happy either way.
    C+/- programmer extraordinaire

  8. #23
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    >> Yes, I apologize for that. I have been traveling.
    No worries. I'm just glad that you're running the contest and there are a few other entries.

    If we only have three entries, are we going to play three handed?

  9. #24
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Quote Originally Posted by jdragyn View Post
    Business travel or personal? Either way, hope your travels were interesting.
    Conference, which was interesting.
    Quote Originally Posted by jdragyn View Post
    I do have a couple suggestions if you want to go ahead and provide some additional info at the end of a hand:
    Those are really good suggestions, but as you point out, it gets complicated with the side pots. Maybe knowing the winner of the main pot would be enough?
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  10. #25
    Registered User jdragyn's Avatar
    Join Date
    Sep 2009
    Posts
    96
    I think that unless you wanted to extend the deadline, leaving it as-is is probably going to be best.

    My entry has been PM'd. It's pretty simple (no, it's not just a "return INT_MAX;"). Good luck Daved and whiteflags
    C+/- programmer extraordinaire

  11. #26
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    I finally had time to get a (somewhat) working test harness... so I guess I have only a couple days left to make a good algorithm. I'm guessing mine will be pretty simple, too.

  12. #27
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    Ok, I submitted mine.

    I got busy with work so I didn't have time to add some more complex ideas I had. I guess we'll see what happens.

  13. #28
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    OK, so I have three submissions: whiteflags, jdragyn and Daved.

    Now it's Easter and I am going away. But I'll bring my laptop and hopefully the results won't take that long. This is going to be interesting.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  14. #29
    Registered User jdragyn's Avatar
    Join Date
    Sep 2009
    Posts
    96
    Enjoy your Easter! Unless you really wanna geek out for your own sake and get the results, I am in no hurry and will be happy to wait until next week. Cheers!
    C+/- programmer extraordinaire

  15. #30
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    I'm on the train now and have coded the framework. Daved seems to be doing well. I still have to make sure there are no bugs before I post any results.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple space combat AI
    By VirtualAce in forum Game Programming
    Replies: 5
    Last Post: 01-06-2009, 12:54 AM
  2. chess ai contest
    By Raven Arkadon in forum Contests Board
    Replies: 7
    Last Post: 07-09-2005, 06:38 AM
  3. AI Contest Proposal
    By MadCow257 in forum Contests Board
    Replies: 4
    Last Post: 03-13-2005, 03:27 PM
  4. Game Design Topic #1 - AI Behavior
    By TechWins in forum Game Programming
    Replies: 13
    Last Post: 10-11-2002, 10:35 AM
  5. Technique of all board-like games?
    By Nutshell in forum Game Programming
    Replies: 28
    Last Post: 04-24-2002, 08:19 AM