algorithm - Determining winning amount in Poker without creating side-pots -


I am trying to run a poker simulation and have the following data about a poker table

  • How much contributed to the vessel for each player
  • A "hand score" for each player (after the flop) (i.e., if player [0] .score == player [1] .score

    For example,

      player [0]. Contributed = 100 players [1] Contributed = 80 players [2]. Contributed = 20   

      player [0] .score = 10 player [1] .score = 2 player [2] .score = 10   

      total_pot = 200;   

    In this example, do I need to return the first player [0] 20 and place it in the pot

    Then, since players [0] and players [2] are tied to the first place, and players [ 1] is lost, the vessel should be divided as:

      players [0]. Ridgewed = 170 player [1]. Respected = 0 player [2]. Respected = 30   

    And later, if the player had won [1] The vessel should be divided into:

      players [0]. Obtained = 20 players [1]. Obtained = 180 players [2]. Resized = 0    

    first descending by descending, so that you will end up with two groups With: {0, 2}, {1}

    Then, sort each group in order of sorting: {2 (20), 0 (100)}, {1 (80)}.

    Now, split the vessel in that order:

    1. First you will take maximum (maximum) 20 from each player's contribution, the first vessel and the same Divide into forms 2 and 0. The first vessel will be 20 + 20 + 20 = 60. Therefore both 0 and 2 will be given 30) After that, the first players are won, and you are left with: {0 (80)}, {1 (60)}.

    2. Now, to create the next utensil (80 + 60 = 140) from the contribution of each player (80) and it 0 (no division is needed because the top group Does not have more than one, so 0 will get full 140). You will be left with: {1 (0)}.

    3. No contribution has been left, therefore you have done

      So, in your example, 0 would get 170 and 2 would get 30.

Comments