Skip to content

feat: Social Deduction Game demo#36

Merged
JNK234 merged 7 commits into
mainfrom
social-deduction-game
Mar 19, 2026
Merged

feat: Social Deduction Game demo#36
JNK234 merged 7 commits into
mainfrom
social-deduction-game

Conversation

@JNK234

@JNK234 JNK234 commented Mar 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Social Deduction Game (Undercover / Spy Words) — LLM agents play a word-guessing party game where one spy has a different-but-similar word
  • 4-8 players describe their word via llm:chat-with-template, vote to eliminate via template + llm:choose fallback
  • 3 difficulty levels (15 word pairs), cumulative stats, auto-reveal
  • Noir visual theme: charcoal gradient, dark red table, 8-color player palette, vote arrows, center phase indicator
  • Dramatic spy reveal with enlarged red spy, all words shown

Files added

  • demos/social-deduction-game/social-deduction-game.nlogox — game model
  • demos/social-deduction-game/config.txt — LLM provider config
  • demos/social-deduction-game/description-template.yaml — description phase prompt
  • demos/social-deduction-game/vote-template.yaml — voting phase prompt
  • demos/social-deduction-game/README.md — setup and usage docs

Test plan

  • Opens in NetLogo 7.0.3 without errors
  • Setup creates 6 colored players in circle, dark background, red table
  • Step runs full round: descriptions, vote arrows, elimination
  • Game completes to win condition (spy or regulars)
  • Spy reveal shows all words, enlarged red spy
  • New Game resets cleanly, cumulative stats preserved
  • Test with 4 and 8 players
  • Test all 3 difficulty levels

JNK234 added 5 commits March 18, 2026 03:03
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.
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
- 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
… 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
- 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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 151d8268de

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +505 to +508
<button x="120" y="10" width="100" height="40"
disableUntilTicks="false" kind="Observer" display="Go" forever="true">go</button>
<button x="10" y="60" width="100" height="40"
disableUntilTicks="false" kind="Observer" display="Step" forever="false">step-round</button>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Disable Go/Step until setup initializes game state

On a freshly opened model, these buttons are clickable before setup runs. go/step-round immediately test game-over? and llm-config-loaded?, but those globals are only initialized in setup, so NetLogo will evaluate their default numeric values instead of booleans and throw. This makes the demo fail on a very common first interaction: clicking Go or Step before Setup.

Useful? React with 👍 / 👎.

]

;; Word leak check: if description contains the actual word, replace
if member? my-word desc [

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Match leaked secret words by token, not substring

member? on strings is a substring check, so this censors valid descriptions whenever the secret word appears inside another word. For example, the tea player saying steam rises from it would be replaced with the generic fallback even though no leak occurred. That systematically degrades some word pairs and changes vote outcomes for reasons unrelated to the agents' reasoning.

Useful? React with 👍 / 👎.

JNK234 added 2 commits March 18, 2026 14:07
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
- 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 outputs
@JNK234
JNK234 merged commit f02823f into main Mar 19, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant