# Deployer of the Game Cannot Reset Without Claims
## Description
- Normally, the game should be able to end and reset even if no one has claimed the throne.
- The current implementation requires at least one claim before the game can end, otherwise gameEnded remains false and the owner cannot reset the game.
- The game doesnot end with any `GRACEPERIOD` expire till someone doesnot claim the throne.
- The game cant be reset even if there is a claim throne, it resets when the winner is declared.
## Risk
**Likelihood**:
- This will occur whenever a new game round starts and no one claims the throne.
- The contract will be stuck in a state where it cannot be reset.
**Impact**:
- The owner cannot reset the game, and the contract becomes unusable until a claim is made.
- Funds and game logic are locked, requiring a forced claim to proceed.
## Proof of Concept
- Start a new game round and do not call claimThrone. Attempt to resetGame.
**Proof Of Code**
- Add the following code in `Game.t.sol` and see...
```javascript
function testResetGameFails() public {
vm.startPrank(deployer);
// Simulate the passage of time
vm.warp(block.timestamp + GRACE_PERIOD + 1);
// Fails, game not ended
assertTrue(game.gameEnded(), "Game should have ended after grace period");
// Comment the above assert and see reset Game fails, deployer cant reset the game
game.resetGame();
vm.stopPrank();
}
```
- The game only resets when someone claims the throne and that someone is declared a winner.
```javascript
function testResetGamePasses() public {
vm.startPrank(deployer);
// Claim the Throne
game.claimThrone{value: game.claimFee()}();
// Simulate the passage of time
vm.warp(block.timestamp + GRACE_PERIOD + 1);
// Declare winner
game.declareWinner();
// Passes
assertTrue(game.gameEnded(), "Game should have ended after grace period");
// Passes
game.resetGame();
vm.stopPrank();
}
```
## Recommended Mitigation
Allow the owner to reset the game even if no claims have been made, or provide a function to force-reset in such cases.
```diff
- require(currentKing != address(0), "Game: No one has claimed the throne yet.");
+ if (currentKing == address(0)) {
+ gameEnded = true;
+ emit GameEnded(address(0), 0, block.timestamp, gameRound);
+ return;
+ }
```
---