Contents Domain Illustration Methods Conclusions |
Domain ROI, the agent I have designed, is concerned with playing a specific card game. In this card game, several players compete to rid their hand of all the cards before the other players. The card game has several important rules. Play occurs in a circle, with each player playing one card from their hand that is of equal or greater value than the previous card played. If either four cards of the same value or a two card is played, the discard pile is reset, and the last player to go plays a new card. Once the discard pile has reached a point where no players can put down another card, the pile is reset and the last player to play a card can play any card in their hand. Play continues in this manner until someone wins, by removing all the cards from their hand first. As a result, there are two aspects of the game from a specific player's point of view that must be represented. The first of these are is the discard pile. There are two reasons that knowledge of the discard pile is important. First, knowing whether three Aces have been played already would allow the agent to know that by playing its Ace it would be able to play a high card and keep control of the game play by not allowing any of the other players to discard a card. The other reason is that playing four cards in a row will allow the player of the fourth card to reset the pile and play a second card in a row. The second aspect of the game that must explicitly be represented is the list of cards in a player's hand. This will allow the player to be aware of what cards are available, so that some strategy may be formulated. In order for this game to work correctly, we must record the following bits of information regarding cards: card 3 is of lesser value than 4, card 4 is of lesser value than card 5, and so on and so forth. Also, we must record that a card of value 2 clears the pile, thus making it of a greater value than the other cards. Some sample runs from Prolog: The agent works by asking the question: what cards in my hand are playable with the given top card on the discard pile? The agent then goes about this by selecting the top card off the discard pile and determining a list of playable cards. The agent then selects the "best" card from the list of playable cards. The "best" card can be determined from a number of simple methods, such as simply taking the lowest playable card, or by formulating a simple strategy such as playing an Ace when it knows that all the other Aces have already been played in order to retain control of the game. This is a simplified version of a more complicated game with many additional rules that could potentially be added. For example, the three-cards could be considered wild, and thus allowed to assume the value of any other card. Also, any number of cards could be played per turn, such as pairs, triples, and quadruples. Depending on the number of players, more than one deck of cards can be used. By playing two cards of the same type in a row, such as one player playing a 5 and a the following player also playing a five, the next player is skipped and play picks up with the fourth player. Also, play usually continues until all the players have run out of cards, thus developing a ranking of the players. Any and all of these rules can be added to the game to develop a more responsive agent. |