# Septica

Septica is a well-known romanian trick-taking card game. The rules are as follows:

• There are 32 cards in total: 7, 8, 9, 10, 11, 12, 13, 14 (4 of each type).
• In our case, the game is played between two players: your program and the computer.
• At the beginning of the game, each player receives 4 randomly chosen cards from the deck.
• Players alternate taking turns. The computer always starts first.
• In each turn, a player chooses any card from his hand, and puts it face up on the table.
• Cutting is defined as playing a 7 or a card with the same value as the initial one.
• If a player cuts, the trick continues in the same manner, until one of the players does not cut. The last player that cut wins all cards used in the trick and leads the next trick.
• After a trick ends, both players draw cards from the deck until they have 4 cards in their hand or the deck is empty.
• When the deck contains no more cards, scores are calculated. The score of a player is defined as the total number of 10 and 14 cards he collected. The player who gets the highest score wins the game. In case of a draw, the computer loses.

## Player commands

x
use card x
0
end current trick. you can only use this command if you started the trick.

Note: After each command you should print a newline character and flush the output (using functions such as fflush(stdout) or cout.flush()).

## Computer commands

At the beginning of each match, the computer prints c1 c2 c3 c4, the cards in your hand, followed by a newline.
x
use card x
2 n x1 x2 … xn
you receive cards x1 x2 … xn from the deck; computer moves next
3 n x1 x2 … xn
you receive cards x1 x2 … xn from the deck; player moves next
4 Scomputer Splayer
current match has ended, you get the scores

## Notes

• When there are no more cards in the deck, the computer will use the commands 2 and 3, with n = 0.
• Your program will play 1000 different matches (you can use a for loop to repeat the functionality of one match, 1000 times). You need to win at least 500 of them in order to be accepted.

## Sample

ComputerPlayerExplanation
14 9 7 10Player's initial cards.
7Computer's first turn.
7Player uses card 7.
3 1 10Current trick ends.
Player collects the cards.
Player receives one card from the deck (10).
Player moves next.
10Player uses card 10.
11Computer uses card 11.
0Player doesn't cut.
Current trick ends.
Player collects the cards.
Player moves next.
3 1 9Player receives one card from the deck (9).
14Player uses card 14.
14Computer uses card 14 (cut).
7Player uses card 7 (cut).
14Computer uses card 14 (cut).
0Player doesn't cut.
Current trick ends.
Computer collects cards.
Computer moves next.
2 2 8 14Player receives two cards from the deck (8, 14).
8Computer uses card 8.
8Player uses card 8 (cut).
3 1 11Computer doesn't cut.
Current trick ends.
Player collects cards.
Player receives one card from the deck (11).
Player moves next.
2 1 10Player receieves one card from the deck (10).
Computer moves next.
10Computer uses card 10.
10Player uses card 10 (cut).
3 0Computer doesn't cut.
Current trick ends.
Player collects cards.
Player receives no more cards, because the deck is empty.
Player moves next.
10Player uses card 10.
13Computer uses card 13.
0Player doesn't cut.
Current trick ends.
Player collects cards.
Player moves next.
3 0Player receives no more cards, because the deck is empty.
2 0Player receives no more cards, because the deck is empty.
Computer moves next.
13Computer uses card 13.
14Player uses card 14.
4 4 4Computer has no cards left.
Player collects cards.
Match has ended with score 4 - 4 (the player has won).
Another match will start.
12 12 9 14Player's initial cards in the second match.
8Computer's first turn.
Questions?