<commit_before>Love Letter Manager
===================

This is the game manager for the HackSoc Love Letter AI competition in
Summer term. This is provided, along with some sample AIs, as a
reference implementation of the rules which people should make use of
when implementing their own AIs.

How to Play
-----------

Love Letter is a game for 2 to 4 players. At the start of the game,
the deck is shuffled and every player is dealt one card. The top card
of the deck is then set aside, face down. This prevents players from
having perfect information.

On a player's turn they draw a card, and choose one of their two cards
to play. All cards are played face up in front of the player who
played them.

A round ends when a player's turn ends and there are no more cards
left in the deck, or when all of the players but one are out. At this
point, all of the players still in compare hands, and the player with
the highest-valued card wins.

The player who won becomes the first player in the next round of the
game.

A player must win four rounds to win a game, and so the maximum number
of rounds in a game is 13.

*If you want to try the game out a bit before writing your AI, come
along to CoffeeScript, to which barrucadu often brings the game.*

### Cards

There are 8 types of cards in the game, worth varying amounts of
points.

If a card mentions a "target player", that cannot be the person
playing the card, with the exception of the **Wizard**.

 - **Princess** (8 points, 1 in deck) - if you play or discard it, you
   are out.

 - **Minister** (7 points, 1 in deck) - if your hand is worth 12 or
   more, you are out.

 - **General** (6 points, 1 in deck) - change hands with the target
   player.

 - **Wizard** (5 points, 2 in deck) - target player discards their
     hand and draws a new card.

 - **Priestess** (4 points, 2 in deck) - ignore all cards targeting
   you until your next turn.

 - **Knight** (3 points, 2 in deck) - compare hands with target
     player, lowest hand is out, if hands are equal nobody is out.

 - **Clown** (2 points, 2 in deck) - look at target player's hand.

 - **Soldier** (1 point, 5 in deck) - name a non-soldier card, if the
   target player has that card, they are out.

AIs
---

AIs can be implemented in whatever language you want, but we must be
able to compile and run them. If in doubt, produce something which
works on the ITS Linux machines.

### Communication

The manager and AIs will communicate over stdin and stdout. After
launching an AI, the manager will first send it its player number, and
then which card it draws for its initial hand.

If an AI is knocked out (or forfeits), it will be sent SIGTERM.

All AIs will be executed anew at the start of a round. SIGTERM will be
sent to all AIs when a round ends.

### Messages

Messages that the manager may send an AI:

 - `player <n>` - it is the turn of player `n`.
<commit_msg>Updated love letter manager spec.<commit_after>Love Letter Manager
===================

This is the game manager for the HackSoc Love Letter AI competition in
Summer term. This is provided, along with some sample AIs, as a
reference implementation of the rules which people should make use of
when implementing their own AIs.

How to Play
-----------

Love Letter is a game for 2 to 4 players. At the start of the game,
the deck is shuffled and every player is dealt one card. The top card
of the deck is then set aside, face down. This prevents players from
having perfect information.

On a player's turn they draw a card, and choose one of their two cards
to play. All cards are played face up in front of the player who
played them.

A round ends when a player's turn ends and there are no more cards
left in the deck, or when all of the players but one are out. At this
point, all of the players still in compare hands, and the player with
the highest-valued card wins.

The player who won becomes the first player in the next round of the
game.

A player must win four rounds to win a game, and so the maximum number
of rounds in a game is 13.

*If you want to try the game out a bit before writing your AI, come
along to CoffeeScript, to which barrucadu often brings the game.*

### Cards

There are 8 types of cards in the game, worth varying amounts of
points.

If a card mentions a "target player", that cannot be the person
playing the card, with the exception of the **Wizard**.

 - **Princess** (8 points, 1 in deck) - if you play or discard it, you
   are out.

 - **Minister** (7 points, 1 in deck) - if your hand is worth 12 or
   more, you are out.

 - **General** (6 points, 1 in deck) - change hands with the target
   player.

 - **Wizard** (5 points, 2 in deck) - target player discards their
     hand and draws a new card.

 - **Priestess** (4 points, 2 in deck) - ignore all cards targeting
   you until your next turn.

 - **Knight** (3 points, 2 in deck) - compare hands with target
     player, lowest hand is out, if hands are equal nobody is out.

 - **Clown** (2 points, 2 in deck) - look at target player's hand.

 - **Soldier** (1 point, 5 in deck) - name a non-soldier card, if the
   target player has that card, they are out.

AIs
---

AIs can be implemented in whatever language you want, but we must be
able to compile and run them. If in doubt, produce something which
works on the ITS Linux machines.

### Communication

The manager and AIs will communicate over stdin and stdout. After
launching an AI, the manager will first send it its player number, and
then which card it draws for its initial hand.

If an AI is knocked out (or forfeits), it will be sent SIGTERM.

All AIs will be executed anew at the start of a round. SIGTERM will be
sent to all AIs when a round ends.

### Messages

Messages that the manager sends an AI before the game begins:

 - `ident <n>` - your player ID is `n`. Integer from 0 to `count(players)-1`. Print your player's name to stdout upon receipt of this message.

 - `players <n>` - the number of players `n` in the game.

 - `start <n>` - the ID of the starting player.

Messages that the manager may send an AI:

 - `player <n>` - it is the turn of player `n`.

{'fraction_non_alphanumeric': 0.06988108812510181, 'fraction_numerical': 0.007818863007004398, 'mean_word_length': 3.3269908386187454, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '786111', 'n_tokens_mistral': 1764, 'n_tokens_neox': 1660, 'n_words': 1092}