The forums will be going offline for an extended maintenance period at 1400hrs GMT on 19th June 2025. The number of hours for this downtime is intentionally not advertised due to the nature of these upgrades.
×
- 0
Bitwise Operators / Binary values
-
Recently Browsing 0 members
- No registered users viewing this page.
Question
Bake Mono
I was working on a card game (poker) and ran into a slight problem. I started with an array that gave all cards a certain value. The following shows how the values were given.
2, 3, 4, 5 ... King, Ace
1, 2, 4, 8 ... 2048, 4096
No matter what suit they had, a straight (ace high) would have a value of 7,936. This made it easy to determine the hands and who won. However the problem started when ever there were multiple values of some cards. The following hand is an example:
Note: 2 cards in hand + 5 on table = 7 cards total
Card: 2, 2, 3, 3, 4, 5, 6
Val : 1, 1, 2, 2, 4, 8, 16
Total value of 34
With the total value of 34, it reads it as 32 + 2. So esseitially I can not check for that value, because if someone had a 7 and 3 card, they would have the same value.
Is anyone able to think of an alternative to this, or possibly a way that I can use the bit values given to the card to accept and/or search for a pair, two pair, three of a kind, full house, four of a kind? I've been trying to think of alternatives for close to a week and it's just giving me a headache.
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.