Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Matlab problem m ceil(rand Length(i): jn) function B buttons Initialize push buttons and text set(gcf, 'menubarnone,numbertitle,off, 'name, 'Tictactoe) for k 1:25 B(1,juicontroll'style,'pushbutton,'units,'normal, B zeros(5,5) =

Matlab problem image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
m ceil(rand Length(i): jn) function B buttons Initialize push buttons and text set(gcf, 'menubarnone,"numbertitle,"off, 'name, 'Tictactoe) for k 1:25 B(1,juicontroll'style,'pushbutton",'units,'normal, B zeros(5,5) = magic(5); 'fontsize',16, 'callback,'tictactoel "green")): uicontroll'style,'textunits',normal, 'pos",(e.1e 0.82 .40 e.1, fontsize',28, 'background',get (gcf, 'color,'tag,'toptext) fontsize,10, 'background' get(gcf,'color,'tag,'toptext,"string ['Pick single digit numbers. Each digit can be chosen only once. uicontrol('styletext,"units',normal, 'pos", te.20 0.72 .60 e.1el, Generate a total of 15 using exactly three digits.") uicontrol('style',pushbutton,'units,"normal','string", "Game". uicontrol'style',"pushbutton,'units,"normal,'string, "Start', uicontrol'style',pushbutton,'units,"normal,'string","Exit', fontsize',12, 'position. .13.12.15.07 callback,'tictactoel "gane)') fontsize',12, 'position.1.43.12.15 .07 . callback,'tictactoel 'start)) fontsize',12, 'position..83.12.15.07 . callback,'tictactoel "exit'): function [X,game, 8)getgame % Restore the state of the gane ud get (gcf, 'userdata"); game ud(2); function savegane(x,gane,B) Update the display and save the state of the game nag ic (5); for k 1:25 M switch game case 1 % Pickl5 poS # [0.10*k-0.055 0.50 0.10 @. 1333); str int2str(k): case 2 % TicTacToe pos # [0. 10*j+0.25 0. 1333*(6-1)+0.17 0.10 0.1333); case 3 % Magic3 pos 0.10 j.0.25 0.1333 (6-1)+0.17 .10 .13331 tr-int2str(k) switch X(1,j) bg"white' case 1 bg 'green' set (B(i,j), 'position',pos, 'string',str. background,bg T-flipud(findobj(gcf, 'tag', "toptext)) set (T(2), 'visible', 'of switch winner(X) 'fontsize,16, callback', 'tictactoe "green' end uicontrol('style','text,"units, normal', 'pos,[0.18 8.82 .40 .1], 'fontsize',20, 'background'.get(gcf, "color),'tag,'toptext') uicontrol('style, 'text', "units',normal','pos', [0.20 0.72 0.60 0.101, 'fontsize,1, background' ,get (gef, "color), 'tag', 'toptext, 'string', ['Pick single digit numbers. Each digit can be chosen only once. '... Generate a total of 15 using exactly three digits.'1) uicontroll'style','pushbutton,"units', 'normal, "string, 'Game', uicontrol('style','pushbutton',"units' 'normal, 'string, 'Start', uicontroll'style','pushbutton, 'units','normal',"string,"Exit',... fontsize',12, position',.13.12 .15 .07, callback,'tictactoel "game") 'fontsize,12, position.1.43.12.15.071, callback','tictactoel''start) fontsize',12, 'position',[.83 1215 .071, callback",'tictactoe "exit) function [x, game, 81 getgane Restore the state of the game ud get(gcf, 'userdata); X ud(1); gane :ud(2); function savegame(x, gane, B) % Update the display and save the state of the game M magic(5); for k 1:25 switch gane case 1 % Picks pose.10+k-0.0855 8.50 8.10 0.1333] tr int2str(k): case 2 TicTacToe pos [e.10 j+8.25 .1333 (6-1)+0.17 0.10 .1333 case 3sMagic3 pos-[0.10+j+0.25 8.1333 (6-1)+0.17 0.1 8.1333 str = int2str(k); end switch X(i,j) case -1 bgblue' case 0 bgwhite' bggreen' end set (B(i,j), 'position pos, "string,str, 'background", bg) end Tflipud(findobj(gcf, 'tag, 'toptext') set (T(2), 'visible, "off switch winner(X) case 0 switch gane case 1, set(T(1), string', 'Pick15') set (T(2), 'visible',"on case 2, set(T(1), 'string', 'TicTacToe") case 3, set (T(1), string', 'Magic3') end case -1, set (T(1), 'string', 'Blue wins case 1, set(T(1), 'string', 'Green wins' case 2, set (T(1), 'string,'Draw end set (gcf, 'userdata, x,game, B m ceil(rand Length(i): jn) function B buttons Initialize push buttons and text set(gcf, 'menubarnone,"numbertitle,"off, 'name, 'Tictactoe) for k 1:25 B(1,juicontroll'style,'pushbutton",'units,'normal, B zeros(5,5) = magic(5); 'fontsize',16, 'callback,'tictactoel "green")): uicontroll'style,'textunits',normal, 'pos",(e.1e 0.82 .40 e.1, fontsize',28, 'background',get (gcf, 'color,'tag,'toptext) fontsize,10, 'background' get(gcf,'color,'tag,'toptext,"string ['Pick single digit numbers. Each digit can be chosen only once. uicontrol('styletext,"units',normal, 'pos", te.20 0.72 .60 e.1el, Generate a total of 15 using exactly three digits.") uicontrol('style',pushbutton,'units,"normal','string", "Game". uicontrol'style',"pushbutton,'units,"normal,'string, "Start', uicontrol'style',pushbutton,'units,"normal,'string","Exit', fontsize',12, 'position. .13.12.15.07 callback,'tictactoel "gane)') fontsize',12, 'position.1.43.12.15 .07 . callback,'tictactoel 'start)) fontsize',12, 'position..83.12.15.07 . callback,'tictactoel "exit'): function [X,game, 8)getgame % Restore the state of the gane ud get (gcf, 'userdata"); game ud(2); function savegane(x,gane,B) Update the display and save the state of the game nag ic (5); for k 1:25 M switch game case 1 % Pickl5 poS # [0.10*k-0.055 0.50 0.10 @. 1333); str int2str(k): case 2 % TicTacToe pos # [0. 10*j+0.25 0. 1333*(6-1)+0.17 0.10 0.1333); case 3 % Magic3 pos 0.10 j.0.25 0.1333 (6-1)+0.17 .10 .13331 tr-int2str(k) switch X(1,j) bg"white' case 1 bg 'green' set (B(i,j), 'position',pos, 'string',str. background,bg T-flipud(findobj(gcf, 'tag', "toptext)) set (T(2), 'visible', 'of switch winner(X) 'fontsize,16, callback', 'tictactoe "green' end uicontrol('style','text,"units, normal', 'pos,[0.18 8.82 .40 .1], 'fontsize',20, 'background'.get(gcf, "color),'tag,'toptext') uicontrol('style, 'text', "units',normal','pos', [0.20 0.72 0.60 0.101, 'fontsize,1, background' ,get (gef, "color), 'tag', 'toptext, 'string', ['Pick single digit numbers. Each digit can be chosen only once. '... Generate a total of 15 using exactly three digits.'1) uicontroll'style','pushbutton,"units', 'normal, "string, 'Game', uicontrol('style','pushbutton',"units' 'normal, 'string, 'Start', uicontroll'style','pushbutton, 'units','normal',"string,"Exit',... fontsize',12, position',.13.12 .15 .07, callback,'tictactoel "game") 'fontsize,12, position.1.43.12.15.071, callback','tictactoel''start) fontsize',12, 'position',[.83 1215 .071, callback",'tictactoe "exit) function [x, game, 81 getgane Restore the state of the game ud get(gcf, 'userdata); X ud(1); gane :ud(2); function savegame(x, gane, B) % Update the display and save the state of the game M magic(5); for k 1:25 switch gane case 1 % Picks pose.10+k-0.0855 8.50 8.10 0.1333] tr int2str(k): case 2 TicTacToe pos [e.10 j+8.25 .1333 (6-1)+0.17 0.10 .1333 case 3sMagic3 pos-[0.10+j+0.25 8.1333 (6-1)+0.17 0.1 8.1333 str = int2str(k); end switch X(i,j) case -1 bgblue' case 0 bgwhite' bggreen' end set (B(i,j), 'position pos, "string,str, 'background", bg) end Tflipud(findobj(gcf, 'tag, 'toptext') set (T(2), 'visible, "off switch winner(X) case 0 switch gane case 1, set(T(1), string', 'Pick15') set (T(2), 'visible',"on case 2, set(T(1), 'string', 'TicTacToe") case 3, set (T(1), string', 'Magic3') end case -1, set (T(1), 'string', 'Blue wins case 1, set(T(1), 'string', 'Green wins' case 2, set (T(1), 'string,'Draw end set (gcf, 'userdata, x,game, B

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

Beginning ASP.NET 2.0 And Databases

Authors: John Kauffman, Bradley Millington

1st Edition

0471781347, 978-0471781349

More Books

Students also viewed these Databases questions

Question

Write a Python program to check an input number is prime or not.

Answered: 1 week ago