Search code examples
artificial-intelligencegame-engineexpert-system

A.I. for card game similar to 3-5-8 (also known as Sergeant Major)


I have to implement card game similar to 3-5-8, but I have problem to select proper way for A.I. implementation. Is it possible game A.I. to be created with package like OpenRules business decision management system? I have looked at Drools also, but it seems too complicated.

Are expert systems, in general, proper for such A.I. development?


Solution

  • It depends on whether your solution employs heuristics or algorithms (or possibly a combination of both). For example, in chess you have complete knowledge of the game state and can plan turns in advance so a minimax algorithm allows you to find an "optimal" solution for any given search depth. A heuristic "good enough" solution can be used in situations where an optimal solution is not possible or difficult to determine (because the game state is not fully known, there is chance involved, or the number of player choices is too large to consider). For example, you can easily create basic heuristics for what to do in a blackjack or poker game based on the cards in your hand and the cards showing in other player hands. These simple heuristics could then be later expanded to include additional heuristics.

    Here's a simple set of rules (i.e. heuristics) for winning a trick in a card game:

    Rule FirstPlayHighTrump
       When
          You're playing the first card and
          You have trump cards
       Then
          Play the highest trump card in your hand
    
    Rule FirstPlayHighCard    
       When
          You're playing the first card and
          You don't have trump cards
       Then
          Play the highest card in your hand
    
    Rule PlayHighCard
       When
          You're not playing the first or last card and
          You have a card to win the trick
       Then
          Play the highest card in your hand that will win the trick
    
    Rule PlayLowCard
       When
         You don't have a card to win the trick
       Then
          Play the lowest card in your hand 
    
    Rule LastPlayLowestCardToWin
       When
          You're playing the last card and
          You have a card to win the trick
       Then
          Play the lowest card in your hand that will win the trick
    

    These rules/heuristics are better than picking cards that follow suit at random, but since they don't involve planning for winning the next trick, they can be improved.