# 4745 MINPlay Soroban
# 47
45 MIN
Overview
This challenge tasks you with building a small interactive Soroban-style game in React. A sequence of numbers is shown on the screen; after the sequence ends, you need to check that the calculated sum is correct.
Requirements
- Render a page titled "Play Soroban" with a clear main UI.
- Initially display a Start button.
- On Start:
- Hide the Start button and show a Reset button.
- Begin generating numbers at a fixed SPEED; each interval appends one number to the sequence.
- The first number should appear after pressing Start; display the current number prominently and show a Round indicator (e.g., Round 1).
- Continue until a fixed number of rounds (ROUNDS) is reached, then stop automatically and reveal the result form.
- After end, display a form to check the result with an input and a Check Result button.
- Submitting the form stores the user input and compares it to the actual sum of the generated numbers.
- If the input matches the sum, show a success message; otherwise show a failure message.
- Show a Done button after feedback that resets the game to the initial state (Start visible).
- All tests expect specific data-testids to exist (number, result-form, success-result, fail-result, done, start, reset).
Notes
- Don't create more state than necessary; data that can be computed from other state should be kept out of state.
- If you need to keep some data in memory but you don't need to trigger a rerender, use useRef instead of useState.
- Always clean up the interval on unmount or when the game is reset.
- The Soroban component consumes the total via the data prop; keep the visual in sync with the computed total.
- Tests rely on specific data-testid attributes; keep them consistent.
- The solution integrates with existing components (Button, Soroban) and helper utilities (randomNumber, RESULT_MAX, RESULT_MIN, ROUNDS, SPEED).
Tests
- Renders the page title
- Start button is visible on initial render
- Start button is hidden after starting
- First number appears after starting
- Round indicator displays 'Round: 3' after 3 rounds
- Result form appears after finishing
- Shows a success message when the result is correct
- Shows a failure message when the result is incorrect
- Reset clears numbers and shows the Start button again
- Done button resets the game and shows the Start button