jeudi 5 mars 2015

I need alternating X and O when I click UI buttons in MATLAB

I am making a tic tac toe game and can't figure out the correct order to get alternating buttons. This is the callback for my pushbutton uicontrol





function ex_ttt_update2( handle, event )
persistent var

if (var=='x')
var='O';
elseif (var=='X')
var='X';
else
var='X';


set (handle,'string',var)
end



Aucun commentaire:

Enregistrer un commentaire