- Joined
- Dec 5, 2001
- Location
- Canuckistan
I'm making a game of poker in pascal and i'm stuck on a logic problem.
I need to find a way to check the cards to find out if the cards fit into one of 8 winning categories. But with 7 cards there's alot of winning combinations just starting at the first with a pair. The eight winning combinations are pair (10,J,Q,K,A only), 2 pair, flush, straight, 3ofakind, full house, 4 of a kind, royal flush.
My idea was to setup an array and a bunch of if statements to check the cards to see if there are any card combinations matching the winning combinations. But soon realized that there are 1000's. I need an easier way to do this. Any help would be greatly appreciated.
I need to find a way to check the cards to find out if the cards fit into one of 8 winning categories. But with 7 cards there's alot of winning combinations just starting at the first with a pair. The eight winning combinations are pair (10,J,Q,K,A only), 2 pair, flush, straight, 3ofakind, full house, 4 of a kind, royal flush.
My idea was to setup an array and a bunch of if statements to check the cards to see if there are any card combinations matching the winning combinations. But soon realized that there are 1000's. I need an easier way to do this. Any help would be greatly appreciated.