Poker hand winner5/15/2023 it might be more efficient to determine if we have a flush or straight while we do the sort. We can also take it further by considering the sort as part of the process, e.g. Typically, the winner of each hand of poker is the player that holds the highest ranked hand when all cards are shown at the end of the hand known as the ‘showdown’ or the player that makes the last uncalled bet, thus winning without needing to reach a showdown. but is this really an optimisation as we still need to loop to check suit).īalancing these optimisations vs the core loop approach probably requires looking at probability distributions of hands (and if doing this do you take it further by considering actual hand data which takes in to account that people are more likely to hold onto certain cards/combinations). if (hand = hand) then we must have trips of four of a kind, if (hand + 4 = hand) we must have a straight. PPS If we are going for pure speed optimisation there still may be optimisations possible along the lines of some of things suggested by others above (i.e. ![]() ![]() PS there could by logic errors in here, the concept is sound, but its purely typed in to a browser. One problem with code like this is its not super easy to tell whats going on at first glance as it relies on implicit properties of the sorted set.
0 Comments
Leave a Reply. |