2

I'm developing a gameboard for a 4 players cardgame well know in my region (like a Bridge with 8 cards).

I create a cardcontrol class, all the deck methods and all the logics for value card and score count.

But I need some link or suggestion for the implementation of "computer player" based on a few rules to follow.

Kromster
  • 10,643
  • 4
  • 53
  • 67
Christian
  • 133
  • 4
  • 1
    It's not clear what you're asking here. Are you asking how to program an AI to make intelligent decisions, or how to allow an AI to interact with the gameboard and cards? Or both? If it's the first, you might be interested in these questions: http://gamedev.stackexchange.com/questions/6189/useful-resources-for-beginning-ai http://gamedev.stackexchange.com/questions/2194/new-to-creating-ai-where-to-start – doppelgreener Jan 07 '11 at 08:25
  • how to allow an AI to interact with the gameboard and cards. I have no experience in this kind of develloping, but i know how to develop. Thanks – Christian Jan 07 '11 at 08:26
  • The AI for the card game is very different from game to game, i do not think you are going to find much of an answer with out some specific card game in mind. (You do not play poker in the same way you would spades, gin or rummey for example) – James Jan 07 '11 at 23:32

2 Answers2

1

Try building a class which handles game turns, who knows all the players and their order, in a array for example.

Each time a player (human or CPU) finish playing, check if the condition to end the game (win or lose) are met.

If not, find who will be the next player. In case the next player is CPU, make it choosing the correct card combination according to its level (easy-medium-hard), and then finish the game loop again by triggering the same method I've just discussed.

Delapouite
  • 271
  • 1
  • 4
0

Here's something that I try to follow when programming AIs.

Create a set of "personalities", that is, ways in which you might expect the computer player to act. Have their actions conform to these. For instance, in a card game, you might have 3 personalities: aggressive, defensive and moderate.

Next, when it gets to the computer player's turn, randomly choose an action that conforms to the player's personality, and make sure the action is also in a list of sensible things to do.

So the logic comes down to this:

1- Based on the situation, what is a list of sensible actions to take?

2- Based on my personality, what actions from the above list would I choose?

3- Randomly choose one of these, then do it!

Nick Vaccaro
  • 238
  • 2
  • 9