Jump to content

Array matching and ranking scores


EchoFool

Recommended Posts

Hey,

 

I've been working on a script to match playing card hands in a poker game against the river to return what the hand the user has and who won against other players.

 

The problem is how do i approach an algorithm to do this in the first place.

 

Cards are stored and structured by 2 characters seperated by a full stop.

 

Example - 2 of diamonds and 3 of clubs is:

D.2,C.3

 

now imagine a line of 5 cards (the river) and im trying to work out what they have and return the answer such as:

 

2 pairs or royal flush etc

 

I so far decided my easiest way is to explode on the comma to get each card - then explode a second time on the full stop to get the suit and value into different variables.

 

How ever - after that point im lost how i can do this up against the river to check what hand the user has.

 

Any one got any tips on the best approach ?

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.