Now tighten the rules around when each function can run.
Contract Lifecycle:
The advanced contract has more states than the early lessons:
• No active game
• Game created, waiting for acceptance
• Accepted game, waiting for moves
• Finished game, waiting for withdrawals
Guard the Transitions:
A zero-stake game should not start. An accepted game should not be accepted again. Moves and forfeits should only happen after both players have committed.
Existing Helpers Stay Put:
Keep using checkWin() , checkDraw() , _endGame() , and _resetGame() . This lesson is about missing lifecycle checks, not rewriting win detection.
Your task: Add the missing require checks so every public gameplay function can only run in the correct lifecycle state.