Skip to content

Fix hangman: lowercase 'r' key not registering as a guess#79

Merged
ralyodio merged 1 commit into
mainfrom
worktree-hangman-r-key
Jul 5, 2026
Merged

Fix hangman: lowercase 'r' key not registering as a guess#79
ralyodio merged 1 commit into
mainfrom
worktree-hangman-r-key

Conversation

@ralyodio

@ralyodio ralyodio commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Problem

In hangman, pressing lowercase r did nothing during play. Shift+R worked, and r worked fine everywhere else in the arcade.

Root cause

hangman.Update() (plugins/arcade/hangman.go) bound "r" to "restart":

case "r":
    if h.dead {
        return newHangman(h.user, h.ctx), nil
    }
    return h, nil   // ← swallowed the keypress during active play

The return h, nil ate the r keypress whenever the game was still active, so r never reached the letter-guess logic. Shift+R produces key.String() == "R", which doesn't match case "r", so it fell through and worked — hence the asymmetry.

Fix

r now only restarts when the round is over (h.dead); during play it falls through to the normal guess handling. Added TestHangmanLowercaseRIsAGuess as a regression test.

🤖 Generated with Claude Code

The Update key switch bound "r" to restart, but returned early even when
the game was still active, so lowercase r could never be entered as a
letter guess (Shift+R worked because "R" didn't match the case). Now r
only restarts when dead; otherwise it falls through to the guess logic.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

vu1nz Security Review

0 finding(s) in PR #?

No security issues found.

@ralyodio ralyodio marked this pull request as ready for review July 5, 2026 13:21
@ralyodio ralyodio merged commit 9d0c0a0 into main Jul 5, 2026
5 checks passed
@ralyodio ralyodio deleted the worktree-hangman-r-key branch July 5, 2026 13:21
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