So I’m stuck with making of this card game…
I’ve got some knowledge of C#…
But I don’t get how’ll you code to make the cpu choose the correct card?
I mean literally there’re a lot of combination that can happen…
Will “if else” statement or switch statement be enough or am I missing some advanced programming technique?
What’d you do in your programming of a card game?
Your question isn’t very clear. I’m guessing you’re referring to AI.
You would have to define rules. Which card will the AI place in different scenarios.
I’m just asking for general recommendation…
How can I tackle all the different card plays in lets say normal spade game?
Using “if else” or switch is sufficient?
Generally, you would break down the game’s rules into programming logic and write a fairly basic AI that would play one of its cards depending on the game situation.
Think through how you would play on your turn, and translate that to code.
If that’s not what you’re looking for, you’re asking for specific code to put in your game, and that’s not something people tend to do, because it’s making your game for you.
Best thing to do imo is that you play your game in head and create it.
-Imagine that deck (28 cards? or what ever), then create deck of 28 cards
-deal 5 cards to your self, 5 random cards and make them “taken” or something if there is only 1 copy of it and store in array
-deal 5 to ai, excluding taken cards
-play card
-ai play, decide by his hand cards and field cards
…
and so on, go step by step in head and for every situation you would do in real life, write programming logic, and that part is not even hard with low c# knoweledge
I understand your point
there’s a whole bunch of things I’ll need to write, I know that
its just I’m curious about in which way other persons would prefer to do it…