Commit f02823f
authored
feat: Social Deduction Game demo (#36)
* feat: scaffold social deduction game — config, template, README
Add the supporting files for the Undercover/Spy Words social deduction
game demo: Ollama config, description-phase prompt template, and README
with hypothesis, game mechanics, and setup instructions.
* feat: social deduction game — core game logic and .nlogox model
Implement the full Undercover/Spy Words social deduction game with:
- Circle layout for N players (4-8), one randomly assigned as spy
- Description phase using llm:chat-with-template for word clues
- Voting phase using llm:choose for constrained spy identification
- Elimination with tie-breaking, win condition checks
- 15 word pairs across 3 difficulty tiers
- Cumulative stats tracking across games (detection rate, wins)
- Vote plot and detection rate plot
- Word leak protection and LLM error fallbacks
* fix: nlogox widget attributes and template variable format
- Add disableUntilTicks to buttons (required attribute)
- Add fontSize to monitors (required attribute)
- Fix plot attributes to camelCase (xMin/xMax/yMin/yMax/autoPlotX/autoPlotY)
- Fix llm:chat-with-template to use nested [key value] pairs
- Use llama3.2:3b model name in config
* feat: visual polish — noir theme, distinct colors, vote arrows, phase indicator
- Fix player visibility: radius 10, -90° offset (12 o'clock start), size 4.0
- Distinct player colors: 8-color palette with base-color variable
- Dark noir background: charcoal gradient + dark red circular table
- Vote arrows: directed links from voter to target in voter's color
- Center phase indicator: shows round, phase, elimination, and win state
- Spy reveal: size 5.0, bright red, all words shown on reveal
- Eliminated players: muted color (base-color - 4) instead of gray
- Correct link shape XML for NetLogo 7.0.3 format
* refactor: extract vote prompt to YAML template, use base-color in plot
- Add vote-template.yaml with system/template structure matching description template
- Replace inline vote prompt with llm:chat-with-template call
- Validate LLM response against alive player names, fallback to llm:choose
- Update Votes Per Round plot to use per-player base-color instead of red/sky
- Update info tab to reflect template-based voting
* fix: rewrite prompts for better gameplay — concrete clues, no self-votes
Description template:
- Demand distinguishing clues: "something TRUE about your word that would NOT be true for a similar word"
- Ban vague phrases and "I notice" narration style
- Add good vs bad clue examples for calibration
- Enforce one sentence under 20 words
Vote template:
- Add explicit self-vote prevention: "You CANNOT vote for {player_name}"
- Reinforce constraint in both system prompt and template
- Guide analytical comparison of clues
Voting code:
- Separate template vote and llm:choose fallback into independent carefully blocks
- Prevent cascading errors when template returns self-vote
* fix: enforce unique indirect clues, raise temperature for variety
- Rewrite description template: demand indirect associations, ban obvious properties
- Add good/bad clue examples for calibration
- Explicitly label transcript as "DO NOT repeat any of these"
- Ban common openings ("Best enjoyed", "Often enjoyed")
- Bump temperature to 0.8 in config for more diverse outputs1 parent 146d64f commit f02823f
6 files changed
Lines changed: 772 additions & 0 deletions
File tree
- demos/social-deduction-game
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
0 commit comments