SecretMafia: clearer prompts, readable action broadcasts, quote-scoped discussion - #199
Open
borgr wants to merge 1 commit into
Open
SecretMafia: clearer prompts, readable action broadcasts, quote-scoped discussion#199borgr wants to merge 1 commit into
borgr wants to merge 1 commit into
Conversation
…d discussion Builds on the improvements proposed in TextArena#155 (by @MozerWang): - Role prompts now open with a shared rules block that states the exact role counts and the Day/Night flow, so every player sees the same setup. Factored into one _shared_rules() helper instead of copying the block into each of the four role classes. - Vote / protect / kill actions are broadcast as readable messages (e.g. "votes for [X] during the day phase.") instead of echoing the raw action string, which could be empty or leak private reasoning. - Discussion turns share only the double-quoted portions of a message, keeping a player's private reasoning off the public record. Uses re.findall so multi-sentence quoted speech is preserved (the original captured only the first quoted segment), and falls back to the whole message when no quotes are present so nothing is silently dropped. The win check is rewritten as len(mafia) >= len(villagers) — clearer and free of float division, but algebraically identical to the previous len(mafia) >= len(alive)/2, so game outcomes are unchanged.
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.
Salvages and finishes the improvements proposed in #155 by @MozerWang, who appears to have moved on. Single file, no new deps, applies cleanly to
main.What this does
N Mafia, 1 Doctor, 1 Detective, M Villagers) and the Day/Night flow. Factored into one_shared_rules()helper rather than copy-pasted into each of the four role classes.Player 2 votes for [4] during the day phase.— instead of echoing the raw action string, which could be empty or full of the model's private reasoning.Differences vs #155 (why a fresh PR)
re.search, so it captured only the first quoted segment — a player who said"A." ... "B."would have"B."silently dropped. This usesre.findalland rejoins, preserving multi-sentence quoted speech, and falls back to the full message when no quotes are present so nothing is ever silently swallowed.len(mafia) >= len(villagers)) is kept because it reads better and drops a float division, but note it is algebraically identical to the previouslen(mafia) >= len(alive)/2(sincealive = mafia + villagers) — i.e. it's a readability rewrite, not a behavioural fix. Game outcomes are unchanged.Verification (deterministic, no model needed)
Drove the env end-to-end with a scripted oracle:
{placeholders}, correct per-player id, role counts, and the quote instruction._check_winboth terminal branches (all-mafia-dead → Village win; parity → Mafia win) with correct team rewards.Closes/supersedes #155.