Files
fool-cardgame/docs/GAMEPLAY.md
T

69 lines
3.0 KiB
Markdown

# Gameplay description
Main gameplay cycle is a match of classical `fool` card
game described here as follows.
Card is considered `open` when players can see its front face and
know its suit and value. Otherwise card is considered `closed`.
Game is played with standard 36-card deck.
For now we will form gameplay with two players, game user and computer opponent (bot).
Every player is drawn 6 cards. One card from the rest is laid
open on the table and denotes a trump suit. Cards with the same suit as
trump suit card are called trumps. Rest of the cards are
shuffled and form the deck.
Players make moves in turns. First move is made by player with lowest
card of trump suit in his hand. If there's a tie (e.g. no player has trumps),
player with the lowest card in his hand makes first move. If there's a
tie, first move is done by random player.
To make a move player (call him attacking player) chooses one card from his hand and
lays it open on the table. The next player in clockwise order (we will call him
defending player) must beat this card. To do so, he chooses from this hand
a card of same suit and greater value, or a trump. If defending player needs
to beat a trump, this could be done with a trump only. All cards which are to be
beaten by defending players we call `attacking cards`.
All players (including attacking players) can add cards to the attack. Only
cards with same value as any card laying on the table (initially added for
attack or used by defending player) can be added.
* In any move there could be not more than 6 attacking cards (5 cards if it is the first move
of the game).
* There should not be more attacking cards than card amount in defending player's
hand.
* Cards can be added to attack at any time by any player except defending player.
If defending player beats all attacking cards and no one wishes to add more,
the turn end and all cards from attack are discarded. If the defender is unable (or
just don't want) to beat all cards, he takes all cards from attack to his hand.
Then, every player (starting
from attacking player, then in clockwise order except defending player and defending
player the last) draws cards from deck until they had 6 cards on hand (or the deck is empty).
The card denoting trump suit is considered last card of the deck in this process.
After drawing cards move is passed to next player in clockwise order.
When a player has no cards left (after drawing phase) he leaves the game (all other
players continue play). When only one player is left he is considered loser of the
game.
# Bot logic
## Basic bot
When in need to make move, choose non-trump card with least value among all in hand.
If there is none, choose trump with least value.
When choosing what to add to attack, add all eligible non-trump cards. Add trump cards
only when the deck is empty and you have only trump cards in your hands.
When defending always choose suitable card with least value. Prefer defending with non-trumps
first, use trumps only when necessary.