Hello all,

I have been working on a card game for the last month or so and sofar have created the basics ie. cards, deck... The language is ANSI-C and is created in programmers notepad with devkitpro and MLlib. Everything is working greate so far as in I can shuffle the deck deal cards from the deck ect, ect... But the problem im now facing is that I need to search through the AI's hand and see if it can place the correct set of cards on the table which is where im stuck and not sure how to go about it.

Each player gets 10 cards to start off with and before each turn they must pick up 1 card either from the top of the waste pile or from the top of the deck and the oject is to make a cirten set/sets for each hand ie. 2 sets of 3 of a kind would be 3,3,3 king, king, king or it could be 3 of a kind and run of 5 ie, ace, ace, ace, 3,4,5,6,7

2 represents a wild and jokers(if included) as well.

Ace is high.

I have no idea on how to go about doing this and finding the cards needed to place them on the table if anyone could help me out it would be much appreciated.

I have attached the entire code I have so far hope this can help.



Recommended Answers

All 3 Replies

I did not run your code, but checking is easier with sorted hand. Only you must first cosider the wild cards and include those for analysis.

Hi tonyjv thanks for the reply I'll search around and see if i can find a good sorting method that will be a start thanks for the advice.

I'll save you the trouble of searching around: qsort.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.