I need code for a problem in Matlab
Create a single Matlab script that accomplishes the following:
Defines a blank tic tac toe board, a 3 x 3 matrix, called board with blank spots represented by zeros.
Asks player 1 for a row and column, then puts 1 in a given location.
Asks player 2 for a row and column, then puts 2 in a given location
board = [3][3];
turn = 0; // determines whose chance it is
if turn == 0: // player 1 turn
print('enter row number and column');
x1 = input(); // row
y1 = input(); // column
board[x1][y1] = 1; // place his move
turn = 1;
else if turn == 1: // player 2 turn
print('enter row number and column');
x2 = input(); // row
y2 = input(); // column
board[x2][y2] = 2; // place his move
turn = 0
Get Answers For Free
Most questions answered within 1 hours.