Finally Mascarpone is here!
A Python implementation of the Mascarpone card game, featuring agents (pretty dumb for the moment). This project uses Hydra for configuration management and provides detailed logging of game progression.
Play Mascarpone with your friends online! Start a game server and share the link.
# Install dependencies
pip install -r requirements.txt
# Start the web server
cd src
python web_server.py --port 5000Then open http://localhost:5000 in your browser.
- Enter your name
- Click "Create New Game"
- You'll be taken to a game lobby with a unique room code
- Click "Copy Link" to share the room link with your friends
- Once everyone has joined (minimum 2 players), click "Start Game"
- Enter your name
- Enter the room code shared by your friend (or use the direct link they shared)
- Click "Join Game"
- Wait in the lobby until the host starts the game
- Declaration Phase: Each player declares how many tricks they expect to win
- The last player to declare cannot make the total equal to the number of cards
- Playing Phase: Players take turns playing cards
- Click on a card in your hand to play it
- The highest card wins the trick
- The trick winner leads the next trick
- Round End: Players who didn't match their declaration are eliminated (Mascarpone!)
- Victory: Last player standing wins!
python web_server.py --host 0.0.0.0 --port 5000 --debug--host: Host to bind to (default: 0.0.0.0)--port: Port number (default: 5000)--debug: Enable debug mode
For playing with friends over the internet:
- Deploy on a cloud server (e.g., Heroku, Railway, DigitalOcean)
- Or use a tunneling service like ngrok:
ngrok http 5000 - Share the public URL with your friends
This implementation allows you to:
- Play online with friends via a web interface (no fancy graphics, just functional!)
- Run simulations of the Mascarpone card game with configurable agents
- Track detailed game progression through comprehensive logging
- Customize game parameters through Hydra configuration
mascarpone/
├── config/
│ ├── otherfoldersforconfig # Default game parameters etc...
│ └── config.yaml # Main configuration file
├── src/
│ ├── agents.py # AI agent implementations
│ ├── models.py # Card and game state models
│ ├── mascarpone.py # Core game logic
│ ├── main.py # Entry point (simulation)
│ ├── web_server.py # Web server for online play
│ ├── web_game.py # Web game logic
│ ├── templates/ # HTML templates
│ └── static/ # CSS and JavaScript
└── README.md # This file
Mascarpone is an engaging card game where players must accurately predict and achieve their declared number of tricks. Making too many or too few tricks results in elimination ("Mascarpone"). The last player remaining wins!
- Standard 52-card French deck (no jokers)
- 2 to 10 players
- Suits (highest to lowest): Hearts
♥️ > Diamonds♦️ > Clubs♣️ > Spades♠️ - Card Order: A > K > Q > J > 10 > 9 > 8 > 7 > 6 > 5 > 4 > 3 > 2
- Special Card: Ace of Hearts can be played as either the highest or lowest card (player's choice)
- Round 1: 5 cards
- Round 2: 4 cards
- Round 3: 3 cards
- Round 4: 2 cards
- Round 5: 3 cards
- Round 6: 4 cards
- Round 7: 5 cards
- Round 8: 6 cards
- Round 9: 7 cards
Note: Fewer rounds may be played depending on the number of players and game progression.
- At the start of each round, players declare their expected number of tricks
- The dealer (last to declare) cannot make the total declared tricks equal to the number of cards per hand
- Play proceeds clockwise, with each player playing one card
- Highest card wins the trick; winner leads the next trick
- Players not achieving their declared number of tricks are eliminated ("Mascarpone")
The last remaining player wins the game!
For a deep dive into optimal strategies of a particular scenario that may happen in Mascarpone (2 players, 2 cards), check out the companion repository Mascarpone Strategy Analysis. This analysis:
- Evaluates optimal strategies for declaring 0, 1, or 2 tricks
- Provides probability calculations for different card combinations
- Includes visualization tools for strategy analysis
- Identifies winning positions and optimal play patterns