Explain solidity>address variables

Address Variables

We know when the game ends, but we don't know WHO won. Let's track that.

The address(0) Value:

address(0) is the zero address: 0x0000...0000

We can use it to mean "no winner yet" or "draw".



Adding Winner Tracking:

1. Add a new state variable: address public winner;

2. In startGame, reset it: winner = address(0);

3. In makeMove, when checkWin() is true, set winner = msg.sender; (the player who just moved)

4. When checkDraw() is true, keep winner = address(0); (no winner in a draw)



Add the winner variable and update both startGame and makeMove to track who won.

Add winner tracking
0%
Requirements:
Declares address public winner
Initializes winner in startGame
Sets winner when checkWin is true
Sets winner to address(0) when draw
Winner set before gameOver