Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Hand percentages versus random hand? Please help!

Options
  • 08-04-2009 1:00pm
    #1
    Closed Accounts Posts: 16


    Hi there,
    I'm in college at the moment and I'm working on a poker game program

    One of the elements I'm trying to use is having a percentage value for a particular hand to win, and I will use this so that computer/AI players are able to make intelligent plays.

    Anyways, so what I'm trying to do first and foremost is for pocket cards give a % for each combination (suited and o/s).

    I started by hard coding (ie. typing a line of code individually) for each element in this table:
    http://seoblackhat.com/texas-hold-em-poker-statistics/

    But that's a ridiculous way of doing it. I figure there is a formula of some sort that the person actually used to get all the numbers -- would anybody happen to know what that is?

    Note that it is pocket cards against a RANDOM hand, as opposed to compared with any hand in particular. For this reason (AFAIK) it is different to the % values given in HSP and Poker After Dark and the likes.

    I will also have to get a % for after the flop, but for that I could count the outs and that should be okay.

    Please note that for this project the important thing is the actual code as opposed to where I get the numbers. For that reason it doesn't matter whether I have a concise formula that works it out, or if I have to hard code all the entries in the table I linked to ! So I am not cheating :p It would however save me a bunch of time if I didn't have to type everything in.

    Thanks for any help


Comments

  • Registered Users Posts: 6,696 ✭✭✭Hectorjelly


    Your post isn't that clear, do you want the answers or how to get the answers? If its just the answers you can use pokerstove (http://www.pokerstove.com/) which can give you any holdings equity against any other hand, including random hands


  • Registered Users Posts: 1,002 ✭✭✭fatguy


    I assume they were calculated by taking each hand and running every possible board and every possible other hand against it and counting how often it won. This would be a stupid thing to calculate on the fly, and I think you should use the table provided to weight your starting hands.


  • Closed Accounts Posts: 4,013 ✭✭✭kincsem


    I assume the poker program is Texas hold ‘Em. There are 169 starting two card hands in Hold ‘Em. You need a list of these 169 hands. There are eight types of hand results – bust, pair, two pairs, trips and so on. You need to run a random hand against each of these 169 hands. Then you need to deal the flop, turn, river and assess the result. A high number of deals is preferable, around ten million for each of the 169 hands. Three years ago a thread here asked how often would you have the nuts at the river. I began calculating the percentages for each of the 169 hands. I was 90% complete when unfortunately my father died and I abandoned the work.

    My guess is your teachers want to see you put in effort and thought, but you want to shortcut the process (“ridiculous way”; “save me a bunch of time”.) “Please note that for this project the important thing is the actual code as opposed to where I get the numbers.”

    This list of programs will give you an idea of the steps. Your task is similar.

    hand_assessment.dbf
    nuts_assessment.dbf
    results.dbf
    subject.dbf
    aaaaa.idx
    bbbbb.idx
    ddddd.idx
    dealt.idx
    f1.idx
    f2.idx
    f3.idx
    h1.idx
    h2.idx
    r1.idx
    t1.idx
    a_0_step_through.prg
    a_1_deal_random_cards.prg
    a_1_put_cards_on_board.prg
    a_1_remove_duplicates.prg
    a_2_load_hand_assessment.prg
    a_3_load_nuts_assessment.prg
    d_hole_0_assess_your_hand.prg
    d_hole_10_two_pair.prg
    d_hole_11_one_pair.prg
    d_hole_12_high_card.prg
    d_hole_1_clear_analysis.prg
    d_hole_2_split_rank_and_suit.prg
    d_hole_3_arrange_board_in_order.prg
    d_hole_4_straight.prg
    d_hole_5_flush.prg
    d_hole_6_straight_flush.prg
    d_hole_7_quads.prg
    d_hole_8_full_house.prg
    d_hole_9_trips.prg
    d_hole_x_0_ranking.prg
    d_hole_x_1_ranking.prg
    d_hole_x_2_ranking.prg
    d_hole_x_3_ranking.prg
    d_hole_x_4_ranking.prg
    d_hole_x_5_ranking.prg
    d_hole_x_6_ranking.prg
    d_hole_x_7_ranking.prg
    d_hole_x_8_ranking.prg
    d_hole_x_9_ranking_kickers.prg
    d_hole_z_mark_best_hand.prg
    e_board_0_assess_your_hand.prg
    e_board_10_two_pair.prg
    e_board_11_one_pair.prg
    e_board_12_high_card.prg
    e_board_1_clear_analysis.prg
    e_board_2_split_rank_and_suit.prg
    e_board_3_arrange_board_in_order.prg
    e_board_4_straight.prg
    e_board_5_flush.prg
    e_board_6_straight_flush.prg
    e_board_7_quads.prg
    e_board_8_full_house.prg
    e_board_9_trips.prg
    e_board_x_0_ranking.prg
    e_board_x_1_ranking.prg
    e_board_x_2_ranking.prg
    e_board_x_3_ranking.prg
    e_board_x_4_ranking.prg
    e_board_x_5_ranking.prg
    e_board_x_6_ranking.prg
    e_board_x_7_ranking.prg
    e_board_x_8_ranking.prg
    e_board_z_mark_best_hand.prg
    f_deck_0_assess_your_hand.prg
    f_deck_2_split_rank_and_suit.prg
    f_deck_3_arrange_board_in_order.prg
    f_deck_4_straight.prg
    f_deck_5_flush.prg
    f_deck_6_straight_flush.prg
    f_deck_7_quads.prg
    f_deck_8_full_house.prg
    f_deck_9_trips.prg


  • Closed Accounts Posts: 3,362 ✭✭✭Hitman Actual


    I'm not sure if what I'm suggesting would amount to plagiarism, but you could have a look through Sourceforge for something that would help.

    Edit: To be more specific, I think the open source code here should help.


  • Registered Users Posts: 5,083 ✭✭✭RoundTower


    PocketAces wrote: »
    But that's a ridiculous way of doing it. I figure there is a formula of some sort that the person actually used to get all the numbers -- would anybody happen to know what that is?

    no, there is no such formula. The numbers were computed by brute force.

    Hard coding the numbers would be the most sensible solution imo. However this doesn't mean you have to type them all in individually! Simply select the numbers on the webpage, right-click and click "Copy". Then go back to your program, right click and click "paste" and you will have all the numbers in the table, pasted into your program like magic! This helpful time-saving tip will save you a lot of work over the course of your Computer Science degree.


  • Advertisement
  • Registered Users Posts: 143 ✭✭RacingSilver


    Don't know if the following will help, but have a look

    http://www.gocee.com/poker/HE_Val_Sort.htm


  • Registered Users Posts: 200 ✭✭The_Daddy_H


    For one hand against another preflop, then the best thing is to simply explicitly code the precalculated table into your program.

    For more complex calculations its possible to code a very simple Monte Carlo code. This works well for situations where the number of possible outcomes is very large, too large to be fully enumerated in a reasonable time frame. The Monte Carlo simulation generates a truncated "phase-space" so-to-speak, whereby a small number of evaluated possibilities give an accurate estimate of the fully enumerate system.


Advertisement