Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Im suppose to make a code on MATLAB for a tic tac toe game following those instructions. I need to make user 2 play and

image text in transcribed
Im suppose to make a code on MATLAB for a tic tac toe game following those instructions. I need to make user 2 play and repeat un til one user wins. and display that there is a tie. function [dtictactoel NUNTITLED3 Summary of this function goes here Detailed explanation goes here IT ts 5 5 55S:55 5] C=input ( ' column ' ) R-input ('zOw' TestOm mn ( (surn (TT) ) , (surn (TT') ) , (TT (11+TT (5)-TT (9) ) , (TT (3) +TT (5) +TT (7) ) ) if Test0=#0 disp('0 win.) Testi-min (abs (sum (TT-1) ) , (3um (TT1) ) , (sum (diag (TT-1) ) ) , (sum (diag (TT. "-1) ) ) ) if Testi--0 disp('1 win' end .1 .5 .6 8-end function [d] = tctactoe %UNTITLED3 Summary of this function goes here % Detailed explanation goes TT[5 5 5; 5 5 5; 5 5 5] X-1; O-0; C-input(column') R-input(row') Test0= min((sum(TT)),(sum(TT)),(Tr( 1 )-TT(5)+TT(9)),(TT(3)+TT(5)+TT(7))) if Test00 disp(0 wIn') Test 1 = min( abs(sum(TT-I )).(sum(TT. I )).(sunn( diag(TT-I ))).(sum (diag(TT.'-1 )))) if Testl=-0 disp('I win') end end

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

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Shamkant B. Navathe

7th Edition Global Edition

1292097612, 978-1292097619

Students also viewed these Databases questions