Add the Witch role - #10
Merged
Merged
Conversation
The Witch is a villager with two one-time potions. Each night she learns who the werewolves attacked and may use a healing potion to save them and/or a poison potion to kill any one player. - roles.py: new Role.WITCH; standard_setup seats one once the village has five or more seats. - engine.py: _witch_action runs the Witch's turn after the doctor; the night phase is reworked to resolve multiple simultaneous deaths (_announce_deaths), each of which can still trigger a Hunter shot. Potion use is tracked on GameState so each potion is strictly once-per-game. - agents: new concrete Agent.witch_turn; RandomAgent and LLMAgent override it, CLI HumanAgent prompts for it. The offline mock banks both potions. - prompts: a dedicated witch_request template. - 3 new tests covering the heal and poison potions. Closes #2 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
Author
|
Code review (post-merge record).
Solid PR — the multi-death refactor was the right call rather than special-casing poison. Merged via squash. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the Witch role, requested in #2.
The Witch is a villager with two one-time potions. Each night she is told who
the werewolves attacked and may:
Closes #2
Changes
roles.py— newRole.WITCH;standard_setup()seats one once the villagehas five or more seats.
engine.py—_witch_action()runs the Witch's turn right after the Doctor.The night phase is reworked: it now collects multiple simultaneous deaths
(
_announce_deaths) — the wolf kill and the Witch's poison — and each deathcan still trigger a Hunter shot. Potion use is tracked on
GameState, so eachpotion is strictly once per game.
agents/base.py— new concreteAgent.witch_turn().RandomAgentandLLMAgentoverride it; the CLI'sHumanAgentprompts for it. Existing agentsneed no change.
prompts/templates.py— a dedicatedwitch_request()template; the offlinemock recognises the
witchdecision kind and conservatively banks bothpotions.
Checklist
ruff check .passesmypy deepwolfpassespytestpasses (43 tests; 3 new for the Witch)CHANGELOG.mdandREADME.mdupdatedNotes for reviewers
The night phase changed shape — from "one victim" to "a list of deaths". The
healing potion and the Doctor's protection both cancel the wolf kill
independently. The Witch is briefed via a private
WITCH_NIGHT_INFOevent, sothe LLM agent sees the victim naturally in its prompt log.