@@ -6,28 +6,39 @@ A Bayesian Game implementation featuring a Belief-based Agent using domain-drive
66## Game Rules
77- Judge and Player 1 can see the target die value
88- Player 2 must deduce the target value using only comparison results
9- - Player 1 rolls dice and reports "higher"/"lower"/"same" compared to target
10- - ** CRITICAL** : Player 2 receives ONLY the comparison result , NOT the dice roll value
9+ - Player 1 rolls dice and reports evidence based on selected evidence type
10+ - ** CRITICAL** : Player 2 receives ONLY the evidence results , NOT the dice roll value
1111- Game runs for 10 rounds
1212- Judge ensures truth-telling
1313
14+ ### Evidence Types
15+ ** Basic Evidence** : ` ["higher", "lower", "same"] `
16+ - Standard comparison between dice roll and target
17+
18+ ** Extended Evidence** : ` ["higher", "lower", "same", "half", "double"] `
19+ - Multiple evidence types can apply to single roll
20+ - "half": dice_roll = target/2 (exact integer matches only)
21+ - "double": dice_roll = target* 2 (exact integer matches only)
22+ - Example: target=4, dice_roll=2 → evidence=` ["lower", "half"] `
23+
1424## Development Practices
1525- Use conventional commits when committing code to git
1626- Always use uv and the local venv
27+ - Always use the make file for devops-style tasks
1728
1829## Architecture
1930Domain-Driven Design with 3 modules:
2031
21321 . ** Environment Domain** (` domains/environment/environment_domain.py ` )
22- - EnvironmentEvidence dataclass (contains dice_roll AND comparison_result )
23- - Environment class for target/evidence generation
33+ - EnvironmentEvidence dataclass (contains dice_roll AND comparison_results )
34+ - Environment class for target/evidence generation with configurable evidence types
2435 - ** ACCESS** : Full knowledge of dice rolls and target values
2536
26372 . ** Belief Domain** (` domains/belief/belief_domain.py ` )
27- - BeliefUpdate dataclass (contains ONLY comparison_result )
28- - BayesianBeliefState class for inference
38+ - BeliefUpdate dataclass (contains ONLY comparison_results as List [ str ] )
39+ - BayesianBeliefState class for inference with multi-evidence support
2940 - ** ACCESS** : NO knowledge of dice roll values or true target
30- - ** CONSTRAINT** : Must calculate P(comparison_result | target) probabilistically
41+ - ** CONSTRAINT** : Must calculate P(comparison_results | target) probabilistically for multiple evidence types
3142
32433 . ** Game Coordination** (` domains/coordination/game_coordination.py ` )
3344 - GameState dataclass (tracks full game state)
@@ -63,43 +74,55 @@ bayesian_game/
6374## Key Design Decisions & Architectural Constraints
6475
6576### Information Flow Rules
66- 1 . ** Environment → Coordination** : EnvironmentEvidence (dice_roll + comparison_result )
67- 2 . ** Coordination → Belief** : BeliefUpdate (comparison_result ONLY)
77+ 1 . ** Environment → Coordination** : EnvironmentEvidence (dice_roll + comparison_results )
78+ 2 . ** Coordination → Belief** : BeliefUpdate (comparison_results ONLY as List [ str ] )
68793 . ** NEVER** : Direct Environment → Belief communication
69804 . ** NEVER** : Belief domain access to dice roll values
7081
82+ ### Multi-Evidence Processing
83+ - Environment generates all applicable evidence types for each roll
84+ - Coordination filters dice_roll information before passing to belief domain
85+ - Belief domain calculates joint probabilities: P(comparison_results | target)
86+ - UI displays evidence configuration options (Basic vs Extended)
87+
7188### Domain Separation Principles
7289- ** Environment Domain** : No probability knowledge, pure evidence generation
7390- ** Belief Domain** : Pure Bayesian inference, no knowledge of actual dice values
7491- ** Coordination Layer** : Thin orchestration, responsible for information filtering
7592- ** UI Layer** : Separate from core game logic, can display full information
7693
7794### Critical Implementation Rules
78- - BeliefUpdate dataclass MUST contain only comparison_result
79- - BayesianBeliefState MUST calculate P(comparison_result | target) probabilistically
95+ - BeliefUpdate dataclass MUST contain only comparison_results as List [ str ]
96+ - BayesianBeliefState MUST calculate P(comparison_results | target) probabilistically for multi-evidence
8097- Game coordination MUST filter dice_roll from EnvironmentEvidence before passing to belief domain
8198- Tests MUST verify that belief domain never receives dice roll values
99+ - Evidence type configuration MUST be passed through coordination layer, not directly to belief domain
82100
83101## Maintaining Architectural Integrity
84102
85103### Code Review Checklist
86104When modifying the codebase, ensure:
87- - [ ] BeliefUpdate contains ONLY comparison_result field
105+ - [ ] BeliefUpdate contains ONLY comparison_results field (List [ str ] )
88106- [ ] No dice_roll parameter passed to belief domain methods
89107- [ ] Game coordination filters EnvironmentEvidence properly
90108- [ ] Tests verify belief domain isolation
91- - [ ] Belief calculations use probabilistic formulas, not direct dice values
109+ - [ ] Belief calculations use probabilistic formulas for multi-evidence: P(comparison_results | target)
110+ - [ ] Evidence type configuration flows through coordination layer
111+ - [ ] UI evidence type selection properly configures game behavior
92112
93113### Anti-Patterns to Avoid
94- ❌ ` BeliefUpdate(dice_roll=X, comparison_result =Y) ` - belief shouldn't know dice value
114+ ❌ ` BeliefUpdate(dice_roll=X, comparison_results =Y) ` - belief shouldn't know dice value
95115❌ Direct Environment-Belief communication
96116❌ Belief domain knowing actual dice roll or target values
97- ❌ Hard-coded probability values instead of calculated P(comparison_result | target)
117+ ❌ Hard-coded probability values instead of calculated P(comparison_results | target)
118+ ❌ Passing evidence type configuration directly to belief domain
98119
99120### Correct Patterns
100- ✅ ` BeliefUpdate(comparison_result="higher" ) ` - only comparison result
121+ ✅ ` BeliefUpdate(comparison_results=["lower", "half"] ) ` - only evidence results
101122✅ Environment → Coordination → Belief information flow
102- ✅ Probabilistic calculations: P(roll > target) = (dice_sides - target) / dice_sides
123+ ✅ Probabilistic calculations for multi-evidence: P(comparison_results | target)
124+ ✅ Evidence type configuration handled in coordination layer
125+ ✅ Joint probability calculations: P([ "lower", "half"] | target) = P(dice_roll=target/2 AND dice_roll<target)
103126✅ Clean domain boundaries with no cross-dependencies
104127
105128## Dependencies
0 commit comments