Explain solidity>not operator

Switching Turns

After a move, we need to switch whose turn it is.

The NOT Operator (!):

The ! operator flips a boolean value.

!true becomes false

!false becomes true

Example:

isActive = !isActive;

If isActive was true, it becomes false. If it was false, it becomes true.



For Our Game:

After placing a piece, toggle xTurn to switch to the other player:

xTurn = !xTurn;

If it was X's turn (true), it becomes O's turn (false), and vice versa.



Add this line at the end of makeMove to switch turns after each move.

Toggle turn after move
0%
Requirements:
Toggles xTurn with NOT operator
Toggle comes after board assignment
Inside makeMove function