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
https://forums.phpfreaks.com/topic/216050-array-matching-and-ranking-scores/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.