A simple project for this chapter.
Implement a version of Cthulhu Dice.
Cthulhu Dice is a simple dice game by Steve Jackson games. The rules are relatively simple.
- Each player starts with 3 sanity tokens.
- While there is more than one player with a sanity token.
- The next player, called the caster, selects another player with sanity tokens, the victim
- The caster attacks the victim by rolling a special 12 sided die
- Yellow Sign, probability 5/12.
- The target loses one sanity token to Cthulhu
- Tentacle, probability (4/12)
- The caster takes one sanity token from the victim (regardless of who rolls the die)
- If the caster has no sanity tokens, the token goes to Cthulhu
- Elder Sign, probability 1/12
- The player rolling the die gains one sanity token from Cthulhu
- There are a maximum of 18 sanity tokens. If all 18 are in the hands of players, the player does not gain a sanity token.
- Cthulhu, probability 1/12
- All players lose a sanity token to Cthulhu
- Eye, probability 1/12
- Pick any other result above.
- After the attack, the victim respond by counterattacking the caster. The Victim rolls the die and takes the appropriate action.
- An attack followed by a counter attack constitutes a turn.
- Any player losing all sanity tokens is Mad.
- A mad player still attacks.
- A mad player can not be the victim.
- At the end of a turn, if only one player has sanity tokens, they win the game.
- At the end of a turn, if no players have any sanity tokens, Cthulhu wins the game.
Implement a simple version of the game. Assume
- There will be four players.
- The first player is a human.
- Ask the human, in a readable UI for any actions.
- All other players are an AI
- When rolling an eye, the AI will just re-roll the die until a non-eye even occurs.
- When deciding who to attack, the AI will attack the "first" player with the most sanity tokens.
- If only one player has the most, they will be attacked.
- If multiple players have the same number, the "first" in line will be attacked.