Question: Write a Matlab script that checks whether Player 1 (O) has won the game. If so, the code should output the phrase Player 1 wins!

Write a Matlab script that checks whether Player 1 (O) has won the game. If so, the code should output the phrase Player 1 wins! to the command prompt. Otherwise, it should output the phrase Player 1 has not won yet. Your code should account for whatever happens to be stored in the variable board at the time the code is run. In other words, it should not simply check whether Player 1 has won based on the particular game board shown above. See sample output below:

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

>> problem4

Player 1 has not won yet ...

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

>> problem4

Player 1 wins !

>>

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!