What'll be your programming prototype when making a card game?

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?

You forgot to mention the card game itself, there are different optimal card to choose
in different games.

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.

No, i’m asking, about which card game you want to make, because each card game is programmed differently.

I was addressing the OP. :confused:

Built your first AI with Random.Range

1 Like

I’m specifically talking about 29 (28 in some cases)
how do I make it?

Like this?

int myGame = 29;

We typically don’t write entire games for people unless they pay for it.

2 Likes

of course you don’t :slight_smile:

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.

1 Like

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

3 Likes

thanks everyone :slight_smile:
I’m not asking for specific code :slight_smile:
just the main logic… :slight_smile:

You’re asking if you need a wrench to build a car from scratch. The answer is yes, but that’s not going to help you make the car.

2 Likes

I understand your point :smile:
there’s a whole bunch of things I’ll need to write, I know that :slight_smile:
its just I’m curious about in which way other persons would prefer to do it…