Skip to content

Fix roll button exploit and add debug mode#64

Merged
durangogt merged 7 commits into
mainfrom
copilot/fix-rolling-prevention-bug
Feb 11, 2026
Merged

Fix roll button exploit and add debug mode#64
durangogt merged 7 commits into
mainfrom
copilot/fix-rolling-prevention-bug

Conversation

Copilot AI commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

Players could click roll buttons multiple times per turn to manipulate dice values. Additionally, testing required specific roll values (2-5) that weren't available.

Changes

Roll Prevention

  • Added has_rolled flag that gates all roll button handlers
  • Display "You can only roll once. Result of your roll: X" on subsequent clicks
  • Reset flag on turn change (9 locations) and game load
if roll_clicked:
    if has_rolled:
        msg = f"You can only roll once. Result of your roll: {moves}."
        displayStatus(ALREADY_ROLLED_SURFS[moves], ALREADY_ROLLED_RECT)
        continue
    moves = get_dice_value()
    has_rolled = True

Debug Mode

  • Activate via --debug flag or AGGRAVATION_DEBUG env var
  • Adds ROLL 2-5 buttons below game board when enabled
  • Existing ROLL 1/6 buttons unchanged
  • All debug buttons respect has_rolled flag

Mobile Tap Targets

  • Expanded marble hit detection from 10x10 to 20x20 pixels (TAP_EXPANSION=5)
  • Visual marble size unchanged (7px radius)
  • Added optional highlight parameter to drawPlayerBox() for future UI enhancements
  • Applied to both main and web versions

Test Coverage

  • 17 tests covering roll prevention, debug buttons, error messages, turn logic
  • All existing tests passing
Original prompt

The game currently has a bug and several functionalities that could be improved or added. Please find the required fixes and tasks below:

Issues to Fix and Expected Behavior:

  1. Rolling Prevention Bug:
    • Problem: A player can click the roll button more than once during their turn, allowing them to manipulate the dice roll to get their desired number.
    • Required Fix: Disable the roll button immediately after the player rolls the dice to prevent multiple rolls within the same turn.

Features to Add:
2. Turn-based Rolling Validation:

  • Add functionality to enforce a rule that each player can only roll once per turn.
  • If a player attempts to roll more than once during their turn, display a message stating: "You can only roll once. Result of your roll: X." Replace 'X' with the result of their initial roll.
  1. Debug or Cheat Mode:
    • The current roll 1 and roll 6 buttons, which are used for speeding up testing, should remain untouched.
    • Create a debug mode to facilitate testing with options for players to choose any roll value (1–6).
    • Consider adding buttons below the main game board to represent these roll values only in debug mode.

Additional Improvements:
4. Marble Selection on Mobile:

  • Make the marbles easier to select on mobile browsers. Explore options to increase the tap-target area or add assistive UI enhancements like highlighting selectable marbles when a marble comes into the range of interaction.
  1. Tests:
    • Write tests to ensure that:
      a. Players cannot roll more than once per turn.
      b. If a player tries to roll more than once, the error message appears and the initial roll is displayed.
      c. The roll 1 and roll 6 buttons work correctly and do not interfere with the standard roll functionality.
      d. In debug mode, the selectable roll buttons for values 1–6 function as intended.

This pull request was created from Copilot chat.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 5 commits February 10, 2026 03:26
Co-authored-by: durangogt <10979447+durangogt@users.noreply.github.com>
Co-authored-by: durangogt <10979447+durangogt@users.noreply.github.com>
Co-authored-by: durangogt <10979447+durangogt@users.noreply.github.com>
Co-authored-by: durangogt <10979447+durangogt@users.noreply.github.com>
Co-authored-by: durangogt <10979447+durangogt@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix rolling prevention bug and add turn-based validation Fix roll button exploit and add debug mode Feb 10, 2026
Copilot AI requested a review from durangogt February 10, 2026 03:39
@durangogt
durangogt marked this pull request as ready for review February 11, 2026 04:58
@durangogt
durangogt merged commit b74c43b into main Feb 11, 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.

2 participants