Liar's Dice Documentation
A modern C++20 implementation of the classic dice game with AI players and advanced data structures.
Overview
Liar's Dice is a dice game where players make increasingly bold claims about the dice hidden under cups, trying to outbluff their opponents. This implementation features sophisticated AI players, optimized data structures, and a comprehensive testing framework.
Key Features
- Multiple AI Difficulty Levels: Easy and Medium AI players with different strategies
- Point-based Elimination System: Players start with 5 points and lose them based on game outcomes
- Optimized Game State Storage: Bit-packed representations and cache-efficient data structures
- Database Integration: SQLite-based persistent storage for game history and statistics
- Comprehensive Testing: Unit tests with Boost.Test and integration tests with Robot Framework
- Performance Optimizations: SIMD operations, custom allocators, and efficient algorithms
Documentation Sections
Core Components
- Game Rules - How to play Liar's Dice
- Architecture Overview - System design and patterns
- Core Module - Core game components
Game System
- Game Class - Main game orchestration and logic
- Player System - Base player interface and implementations
- Dice Management - Dice rolling and validation
AI System
- AI System Overview - AI architecture and strategies
- AI Player - AI player implementation
- Easy AI - Simple heuristics-based AI
- Medium AI - Statistical analysis AI with pattern recognition
Data Structures & Optimization
- Data Structures - Advanced containers and algorithms
- Trie Map - Pattern storage and retrieval
- LRU Cache - Efficient caching system
- Sparse Matrix - Game statistics storage
- Compact State - Bit-packed game representation
Database System
- Database System - Complete database documentation
- Database Manager - SQLite integration
- Schema Manager - Database schema and migrations
- Connection Pool - Efficient connection management
- Database schema includes tables for:
- Game sessions and history
- Player statistics and rankings
- AI behavior patterns
- Performance metrics
Statistical Analysis
- Statistics Module - Game analytics
- Accumulator - Real-time statistics
- Distributions - Probability calculations
- Time Series - Temporal analysis
Performance
- Performance Module - Optimization utilities
- SIMD operations for mathematical computations
- Custom memory allocators for reduced fragmentation
- Object pools for frequently allocated objects
Getting Started
Building the Project
# Quick build (Release mode by default) ./build.sh # Debug build ./build.sh Debug # Run the game ./build/standalone/liarsdice
Running Tests
# All tests ./test.sh # Specific unit tests ./build/test/test_game ./build/test/test_ai ./build/test/test_database ./build/test/test_database_manager # Robot Framework tests ./test/robot/run_tests.sh
Architecture & Design
- Architecture Diagrams - Visual system design documentation
- System architecture overview
- Game flow diagrams
- AI decision flow
- Data flow diagrams
- Class hierarchy
- Database ERD
- Memory layout optimization
- Deployment architecture
Navigation
Use the navigation menu to explore:
- Modules - Organized by functionality
- Namespaces - Code organization structure
- Classes - All classes with inheritance hierarchy
- Files - Source code browser
Technical Notes
For implementation details and design decisions, see the Technical Notes section.