The main object of this implementation is to demonstrate knowledge-based
artificial intelligence. The game is simple: cards of the same value form a
pair. The human player's hand is the first box, the human player's pairset is
the second box. The computer player's pairset is the third box. The computer
communicates via the bottom message box, and the human hightlights cards and
clicks the buttons. To request a card from the computer, hightlight its match
in your hand and click the "Request" button. If the computer has it, it will
place it in your hand. Otherwise, click "Draw Card" to take the top card from
the pile. To give a card the computer requests, highlight it in your hand and
click the "Give Card" button. If you do not have a card the computer requests,
tell it to "go fish" with the "Computer Draw" button. As this is a study in
AI, not UI, clicking the wrong thing at the wrong time will confuse the
computer due to little error checking. Finally, turns rotate back and forth (no
second turn for a successful request.)
TODO:
1) Improve the gameOver() method. Right now, when the deck is empty, the
applet just stops and displays a pair count.
2) Add the remaining rules of the game: when deck is empty, allow trading to
continue AND when you successfully gain the card you requested (be it from the
other player or the deck) you go again.
3) Add more error detection to disable buttons when they aren't allowed to be
used.
4) Label windows for the card display.
These are the things I know about. If you find anything else, please
email me!
back