Love Letter IA is a digital adaptation of the popular card game "Love Letter," where players compete against an AI opponent. The game features an interactive graphical user interface (GUI) and strategic gameplay designed to challenge the player's decision-making skills against a computer-controlled opponent.
- AI Opponent: Compete against an AI that makes strategic decisions based on game state and player actions.
- Graphical User Interface (GUI): A user-friendly interface that allows players to easily interact with the game, including selecting cards and viewing game progress.
- Game Mechanics: Full implementation of the "Love Letter" game rules, including card effects, player turns, and win conditions.
- Python: Core language used for the project.
- Libraries:
- Pygame: Used for creating the graphical user interface.
- Random: Used for game mechanics such as shuffling cards and random events.
-
Clone the Repository:
git clone https://github.com/eliottcoint/Love_Letter_IA41.git
-
Navigate to the Project Directory:
cd Love_Letter_IA41
-
Install Dependencies:
- If using a
requirements.txt
file:
pip install -r requirements.txt
- If not, manually install the required libraries:
pip install pygame
- If using a
-
Run the Game:
python main.py
The objective of Love Letter is to eliminate your opponent (the AI) or to hold the highest-value card when the deck is exhausted. Players achieve this by strategically playing cards, each with unique effects, to gain an advantage.
- Each player (you and the AI) is dealt one card at the start of the game.
- The remaining cards form the draw deck, with the top card removed and set aside (face down) to add some unpredictability.
-
Draw Phase:
- At the start of your turn, draw one card from the deck, so you have two cards in your hand.
-
Play Phase:
- Choose one of the two cards to play. Each card has a specific effect that influences the game. After playing a card, its effect is immediately resolved, and it is discarded.
-
AI Turn:
- The AI then follows the same draw and play phases.
-
Round End:
- A round ends in one of two ways:
- If a player is knocked out by a card effect (e.g., the Guard correctly guesses their card).
- If the draw deck is empty, the player with the highest-value card in hand wins the round.
- A round ends in one of two ways:
-
Winning the Game:
- The game continues until a player wins a pre-determined number of rounds.
Each card has a unique effect, and understanding these is key to mastering the game:
- Guard (1): Guess the AI's hand. If correct, the AI is knocked out.
- Priest (2): Look at the AI's hand.
- Baron (3): Compare hands with the AI. The player with the lower value is knocked out.
- Handmaid (4): Protect yourself from other card effects until your next turn.
- Prince (5): Choose any player (including yourself) to discard their hand and draw a new card.
- King (6): Trade hands with the AI.
- Countess (7): Must be discarded if you also have the King or Prince in hand.
- Princess (8): If you discard this card for any reason, you are immediately knocked out.
- Bluffing: Use the Guard wisely to eliminate the AI early by correctly guessing their card.
- Card Counting: Pay attention to the cards that have been played to deduce what might still be in the AI's hand.
- Timing: Hold onto high-value cards like the Princess until the end, but be wary of effects that might force you to discard them.
- Card Effects: Adjust or extend the game mechanics by modifying the card effects in the codebase.
Contributions are welcome! If you have ideas for new features, improvements, or bug fixes, feel free to fork the repository and submit a pull request.
This project is open-source and available under the MIT License.
For any questions, suggestions, or feedback, feel free to reach out via my GitHub profile.