title: Script efficiency - Poker simulations for statistics
body: <p>My question is more about logic than coding itself:
  I am building a python script to simulate poker hands and get statistics from it.
  My code works very well for assigning and comparing hands, and the only bottleneck for my script is getting the best combination of cards for each player:
  The simulation is for omaha - each player gets 4 cards and the board has 5 cards. Each player must use the best combination of 5 cards (2 from the player's hand and 3 from the board).</p>
  
  <p>The problem is: So far the only way I can think of doing this is comparing every possible hand a player can have and then compare to the other players.</p>
  
  <p>For example, player A has cards A1A2A3A4 and the board is B1B2B3B4B5:</p>
  
  <p>First I am comparing all possible hands player A can get:
  [A1A2B1B2B3, A1A2B1B2B4, A1A2B1B2B5,...,A3A4B3B4B5] and get his best hand (that's 60 combinations from each player).</p>
  
  <p>Do this for all players and then check who has the winner hand.</p>
  
  <p>My question is: Do you think there is a way to get each player's best hand without having to check all 60 combinations?</p>
  
  <p>It took me 16 hours to run ~6.5 billion iterations (~2.5 million hands x 60 board combinations x 40 iterations per hand).</p>
  
  <p>Could you also weight in about the efficiency? I don't know if I am trying something impossible to be done here =P</p>
  
  <p>EDIT - SOLVED</p>
  
  <p>Thanks for the inputs, guys. In the end I solved it by using bit manipulation:</p>
  
  <p><a href="https://codereview.stackexchange.com/questions/217597/forming-the-best-possible-poker-hand?noredirect=1#comment421020_217597">https://codereview.stackexchange.com/questions/217597/forming-the-best-possible-poker-hand?noredirect=1#comment421020_217597</a></p>