ID:164787
 
Okay, I'm really stuck on what I should use to have the computer read the hands, such as straights, flushes, pairs, full houses, etc.

As well, I am stuck on how it should detect the higher hands

Such as if two people have a pair, how it will know which one is higher

If anyone can just lead me in teh direction.

I do not need a full code, and actually prefer not the full code so I can learn myself, but if someone could just guide me?

Thanks.
Hmm, the only possible way that I can see it is to make the cards trigger vars..Example: When they are holding maybe a Ace and King(I don't know how to play cards 0_0) a proc determines whether the vars match up and tells the player the result..From there, you should be able to compare the which of the hands are betetr between the players.

mob
proc
Hands()
if(src.ace)
if(src.king)
src.flush = 1
<dm>
In response to Mecha Destroyer JD
Hm. I thought about that, but the problem I see is you would have to figure in every single suit and every single cardvalue.

Then you have to make a ton of different lists.
I just don't see that being done anytime soon. :/
Aha, I thought of something :)

What if each "hand" was contained within a datum, and that datum has a list with the cards required to have it. Then, when you check their hands against it, just remove the cards from the required list. As you do this, add up some form of a "value" to check for higher version of the same hand. If the required card list is empty once their hand has been checked, then they have it. Once you go through all the possible hands, take the one with the highest score and that's the one the player has.

I'm sure there's a better and faster way to handle it, but since you only need to do this at the end of each hand, it should work for you. If you need me to further elaborate on it, I'd be happy to :)
In response to Killerdragon
Meh if its like more than 10, yes it would most likely be a problem..But uh, like I said, I don't know how to play cards..XD
In response to DarkCampainger
Yeah; it would be in the right mind to have a dantom to handle all this.
In response to DarkCampainger
DarkCampainger wrote:
Aha, I thought of something :)

What if each "hand" was contained within a datum, and that datum has a list with the cards required to have it. Then, when you check their hands against it, just remove the cards from the required list. As you do this, add up some form of a "value" to check for higher version of the same hand. If the required card list is empty once their hand has been checked, then they have it. Once you go through all the possible hands, take the one with the highest score and that's the one the player has.

I'm sure there's a better and faster way to handle it, but since you only need to do this at the end of each hand, it should work for you. If you need me to further elaborate on it, I'd be happy to :)


Yes, please, explain more for me.
I am still a bit confused on this one.
Never did work with datums before.
In response to Killerdragon
Killerdragon wrote:
Yes, please, explain more for me.
I am still a bit confused on this one.
Never did work with datums before.

Well, you pretty much set up a set of /hand datums. What you're going to need is a list of cards that make up that hand, the score that hand is worth, and maybe a boolean for whether or not they all need to be the same suite.

Next, when you want to find what a player has, you take their hand and run it against each of the datums. Each time you find a card in the player's hand that matches the datum's hand, remove it from the list. If the list is emptied, then the player has all the required cards for that hand.

Now, this is where the scores of each hand come into play. You'll want a variable that keeps track of the current highest hand the player has, and it's value. If the hand you just checked has a higher value, then replace them with it.

Once all the hands have been run through, that variable should contain the highest possible hand that could be created using the player's card.

Now, I don't know enough about Poker to go much further than that. You might have to write a proc under the /hand datum's if a hand's score is more complicated than that.
In response to Killerdragon
Killerdragon wrote:

Never did work with datums before.

Then check out:

http://www.byondscape.com/ascape.dmb/LummoxJR.2002-0927/
In response to Mecha Destroyer JD
Mecha Destroyer JD wrote:
Then check out:

http://www.byondscape.com/ascape.dmb/LummoxJR.2002-0927/

Thanks, I'll begin to read that to understand more.
Thanks guys, I'm sure I'll find a way now.