Pasoor++ is a high-performance C++ engine for simulating and evaluating the Persian card game Pasoor (a.k.a. the Game of 11). It supports full rule enforcement, Soor detection, AI simulation, undo, JSON serialization, and Redis-based evaluation pipelines — making it suitable for strategy analysis, AI training, and game automation.
- 🎲 Full Pasoor gameplay engine
- 🧠 Monte Carlo–based move evaluation
- 🕵️ Opponent hand guesstimation engine
- 🧵 Multithreaded simulation
- 🧪 JSON-based game state I/O
- 📡 Redis interface for external evaluation clients
- 🔄 Undo system with game state rollback
- 🐳 Docker-ready environment
- ⚙️ GCC 6 & GCC 11 compatible builds
| File/Dir | Description |
|---|---|
main.cpp |
Entry point. Listens on Redis channels and dispatches evaluations or guesses. |
Game.cpp |
Core game logic: turn progression, scoring, Soor rules, state updates, etc. |
Player.cpp |
Manages player hand, pile, moves, scoring, and serialization. |
Deck.cpp |
Manages deck creation, shuffling, drawing, and weighted draws. |
Card.cpp |
Encodes cards as integers (0–51), provides card logic and naming. |
Table.cpp |
Tracks cards on the table and provides utilities to manipulate them. |
Eval.cpp |
Simulates full games from every legal move to produce win-rate and Soor evaluations. |
Guesstimate.cpp |
Estimates unknown cards in opponent’s hand based on last move. |
Cache.cpp |
Routes Redis input to evaluation engines and publishes results. |
makefile |
Supports GCC 6/11, debug/release builds, and modular compilation. |
Dockerfile |
Full build environment including Redis and dependencies. |
include/rapidjson |
Included JSON parsing library used throughout the project. |
- Redis server (locally or via Docker)
- GCC 6 or GCC 11
libhiredis.a,libredis++.a(included statically)- CMake optional (not required)
# Optimized build using GCC 6
make linux
# Debug build
make gdbc
# GCC 11 builds
make gcc11
make gcc11o3
# Build just the object files
make libs
make libs11
# Clean build artifacts
make cleanObject files are stored in
lib/, and output binary isp++.
A Dockerfile is provided to create a reproducible Pasoor++ environment.
docker build -t pasoor++ .
docker run --rm -p 6379:6379 pasoor++- Ubuntu 16.04 base
- GCC 6 and all dependencies
- Compiles and sets up
hiredisandredis-plus-plus - Starts Redis and sets
/var/p++/entry.shas entrypoint
Pasoor++ listens for evaluation tasks via Redis.
games_1togames_10
| Command | Description |
|---|---|
eval |
Evaluate all possible moves for current player via simulation |
guess |
Estimate the likely card(s) held by the opponent |
- Serialized JSON (3D vector of move evaluations or guessed cards)
- Reconstructs game from JSON
- For each legal move:
- Simulates N games (Monte Carlo)
- Reports average score, Soors, win rate, etc.
- Reverts the last play
- Runs simulation to deduce what card the opponent most likely held
- Filters out Soor-creating plays
- Returns high-probability guesses
[
[deck],
[[p1 hand], [p1 pile], ...],
[table cards],
[[p2 hand], [p2 pile], ...],
current_turn,
current_round,
last_winner_index,
[last played cards]
]Use Game::dump() and Game::read() to serialize and restore this format.
Game::explain()— Prints readable game statePlayer::dumpPlay()— Logs player moveDeck::explain()— Prints remaining cardsGame::isIntact()— Validates total card count = 52
- Multiplayer protocol over WebSocket
- Reinforcement learning interface
- Web-based strategy visualizer
- Persian localization
- Benchmarking + performance tuning options
This project is licensed under the MIT License — see the LICENSE file for details.
You're welcome to use, modify, and contribute to this project freely. Contributions are highly encouraged!
Kaveh Sarkhanlou
Pasoor++ Developer | C++ Engineer | Backend Strategist