Now let's create the function where Player O accepts the game by matching the stake.
Accept Game Requirements:
Player O must match the stake that Player X put up: require(msg.value == stake, "Must match stake");
Only Player O can accept: require(msg.sender == playerO, "Only opponent can accept");
The deadline hasn't expired: require(block.timestamp <= acceptDeadline, "Accept period expired");
Game isn't already over: require(!gameOver, "Game already over");
After Validation:
Set gameAccepted = true;
Set lastMoveAt = uint64(block.timestamp);
Double the stake: stake = msg.value * 2;
Create the acceptGame() payable function with all validations.