Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Matlab function called random move.m that generates a random (but valid) move for Player 2 (X). The function should take as input the

Write a Matlab function called random move.m that generates a random (but valid) move for Player 2 (X). The function should take as input the current game board, and output a 22 array giving the row and column of Player 2s random move. See sample function definition below:

function move = random_move ( board )

% Inputs :

% board - a 3 x3 character array representing the current game board

% Outputs :

% move - a 2 x2 array giving a random ( but valid ) move for Player 2 (X), based on the value of board

See sample output below:

>> board = [ O , X , - ; O ,O , - ; O , X , - ];

>> random_move ( board )

ans = 3 3

>> random_move ( board )

ans = 3 3

>> random_move ( board )

ans = 1 3

>> random_move ( board )

ans = 3 3

>> random_move ( board )

ans = 3 3

>> random_move ( board )

ans = 1 3

>>

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Creating A Database In Filemaker Pro Visual QuickProject Guide

Authors: Steven A. Schwartz

1st Edition

0321321219, 978-0321321213

More Books

Students also viewed these Databases questions

Question

2. What, according to Sergey, was strange at this meeting?

Answered: 1 week ago

Question

3. Are our bosses always right? If not, what should we do?

Answered: 1 week ago