Explain solidity>combining logic

Combining Logic

Now let's make makeMove accept a position parameter so players can choose where to play.

uint type:

uint means unsigned integer (positive whole numbers). Perfect for array indices!



Update the function to accept a position:

function makeMove(uint _position) public { }



Then use the parameter:

require(board[_position] == Cell.Empty, "Cell already taken");

board[_position] = Cell.X;

Add position parameter
0%
Requirements:
Has uint _position parameter
Checks board[_position] in require
Sets board[_position] = Cell.X