Thread: "Poker" AI competition

  1. #1
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072

    "Poker" AI competition

    Does anyone remember the Connect Four AI competition I held.. umm.. more than 5 years ago?

    Connect Four: The Tournament Results

    Anyway, I remembered that competition today and I thought it would be fun to hold another. This time the game is Poker... or a simplified version of it.

    Rules
    1. Each player is dealt a hand, which is a uniformly random real number between 0 and 1.
    2. The highest number wins
    3. The first player has to bet 1, which is the big blind.
    4. The players then makes their decisions: check, fold or raise
    5. When every player has either checked or folded, the player with the highest number takes the pot
    6. Regular Hold'em rules apply for all-in
    7. The data type of money is integer.


    Code
    To enter the contest, implement the following function:
    Code:
    int make_bet(int my_id, float my_hand, const GameInfo&  game_info)
    {
       return INT_MAX; //Always all-in
    }
    Where the struct GameInfo looks like this:
    Code:
    struct GameInfo
    {
    int num_players;
    
    int* money; //Chip count for each player (including myself) 
    bool* has_folded; //What players are still in play
    int* has_bet; //What each player has betted
    int curr_max_bet; //Current highest bet
    };
    To check, the function make_bet must return (curr_max_bet - has_bet[my_id]). A smaller bet will be converted into a fold. A bet higher than money[my_id] will be converted to all-in.

    You may use static variables to allocate lots of memory to keep track of your opponents previous moves. This page will probably be edited as people as questions etc.

    Please write in this thread if you plan to enter, so that others know whether this is worth spending time on. The deadline for submissions is April 1st by PM.
    Last edited by Sang-drax; 02-27-2010 at 06:28 PM. Reason: Sign error + grammar
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  2. #2
    Registered User jdragyn's Avatar
    Join Date
    Sep 2009
    Posts
    96
    My first impression of your game was "Oh, this is neat, he simplified poker so we can focus our AI on the betting". But with only one round of betting and no hand information, I don't really see it as poker. Meh, still interested, but I object a bit to calling it a "Poker" AI competition.

    I have a question about the return value. You list "check, fold or raise" as the possibilities. Since there is only one round of betting and someone has to post a blind, the options would actually be "call, fold or raise".

    You list

    (has_betted[my_id] - curr_max_bet)

    as the way to "check" (I'll assume you mean call). That would produce a negative number though unless you are the high better (such as when it gets back around to the big blind) in which case it would produce 0.

    (curr_max_bet - has_betted[my_id])

    sounds like what you probably meant, though it's late and perhaps I need to re-read?

    "...const GameInfo& game_info)" so C++ only, right? And "has_betted" is awkward since "betted" isn't the proper past tense. Probably should be "has_bet".

    How much money will each player start with? I would assume they would all start with the same amount, like a tournament.

    Can we be guaranteed that num_players will remain constant throughout the entire run? If not then we can not keep track of other players reliably. If there are 6 players and player 1 is knocked out, then if num_players is reduced to 5 with player 1 being completely removed, all of our records become invalid.

    How many players will be "at a table" at one time? I doubt all THAT many people are going to participate, so it's not like we'd end up with 140 AI players at the same table... but should we expect possibly more than 10 players to be "seated together"? Most I've ever played with is 11 at a table, though for Texas Hold'em it is theoretically possible to play with 22 players at a table (44 cards [22 players] + 1burn + 3 Flop + 1 burn + 1 Turn + 1 burn + 1 River), 23 if the dealer doesn't burn cards...

    I like the simplicity of the design, but that simplicity also makes it impossible, from what I can tell, to get any information other than what players have bet and who won the hand. It's going to be more of a guessing game than anything.
    C+/- programmer extraordinaire

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    Sounds good. I'm in.

  4. #4
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,613
    Well, I tried.

  5. #5
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Quote Originally Posted by jdragyn View Post
    (has_betted[my_id] - curr_max_bet)

    as the way to "check" (I'll assume you mean call). That would produce a negative number though unless you are the high better (such as when it gets back around to the big blind) in which case it would produce 0.

    (curr_max_bet - has_betted[my_id])

    sounds like what you probably meant, though it's late and perhaps I need to re-read?
    You are right. It will corrected.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  6. #6
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    Will there be a test harness provided ahead of time?

  7. #7
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    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.

  8. #8
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Since very little knowledge of poker is required here, can someone explain this part?

    6) Regular Hold'em rules apply for all-in
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  9. #9
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    Quote Originally Posted by MK27 View Post
    Since very little knowledge of poker is required here, can someone explain this part?

    6) Regular Hold'em rules apply for all-in
    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).

    That is to say at any point you can bet your entire stack of chips or up to whatever the second chip leader has in their stack (obviously you couldn't bet more than anyone else has)

    I agree with the others, a simple Texas Hold'em simulation would not be that hard to write and it would make for a much more interesting competition.
    Last edited by SlyMaelstrom; 03-10-2010 at 10:58 AM.
    Sent from my iPad®

  10. #10
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    A full simulation isn't necessary. I think this one is interesting enough.

    A couple of questions:
    1. Quote Originally Posted by jdragyn
      Can we be guaranteed that num_players will remain constant throughout the entire run?
    2. What languages are acceptable?
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  11. #11
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    >> Why not make a real poker AI? It's not that difficult to code the framework.
    >> a simple Texas Hold'em simulation would not be that hard to write
    Yes, it would be pretty difficult.

    I'd love to try Texas Hold 'em if either of you want to write the simulator and start another contest, but I fear even the AI for the player would be too time consuming for this format.

    The simplified version presented here provides the problem of how to bet. Adding in full hold 'em rules just adds the complexity of calculating odds to make a better hand, but with this version you still get to keep track of player tendencies and betting behavior.

    >> Also, never knowing what the other players had makes it completely worthless.
    I don't think it's worthless, but I do think providing information on who wins each round and all the values for all exposed hands would be beneficial.

  12. #12
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Quote Originally Posted by Daved View Post
    >> Why not make a real poker AI? It's not that difficult to code the framework.
    >> a simple Texas Hold'em simulation would not be that hard to write
    Yes, it would be pretty difficult.

    I'd love to try Texas Hold 'em if either of you want to write the simulator and start another contest, but I fear even the AI for the player would be too time consuming for this format.

    The simplified version presented here provides the problem of how to bet. Adding in full hold 'em rules just adds the complexity of calculating odds to make a better hand, but with this version you still get to keep track of player tendencies and betting behavior.

    >> Also, never knowing what the other players had makes it completely worthless.
    I don't think it's worthless, but I do think providing information on who wins each round and all the values for all exposed hands would be beneficial.
    Well, the framework itself wouldn't be difficult. An actual AI might, as you may have to analyse the chances your hand will win, which is quite difficult. But you can have lesser AI's as well.
    Why I think it's worthless that you don't get the other player's hands is that an AI might study the bet heights of the other players and compare them to how good the hand was. If this can ever be known, the AI would have to become more complicated.

    Right now, all you have to do is calculate the chance your hand will win (hand_quality ^ (num_players - 1)), and simply study the bets of the other players to see if they are too high.
    Really, you can't even figure out if you bluffed out an opponent or the opponent called but had a worse hand.

  13. #13
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    I agree that some additional knowledge of how the hand ends would be necessary, maybe Sang-drax can add that (remember that he asks for improvements and suggestions, this isn't set in stone).

    At this point I'm the only one committed to playing, though. I doubt that he'll even bother if nobody else jumps in.

  14. #14
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,613
    No you aren't the only one playing. I already sent sang-drax my file.

  15. #15
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    Oh, sorry. I didn't realize that's what your post meant.

    I guess that means there's two of us.

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