Borrar filtros
Borrar filtros

How to write a function that places pieces on a tictactoe board in a GUI.

1 visualización (últimos 30 días)
rayray
rayray el 24 de Abr. de 2018
Comentada: Geoff Hayes el 26 de Abr. de 2018
what i have so far for this function is this:
function handles = buttonPress(hObject,handles)
if handles.(hObject.Tag).String == ''
if handles.turnNumber ==1
handles.(hObject.Tag).String = 'o'
else
handles.(hObject.Tag).String = 'x'
end
end
end
I just don't understand what it even does. I am so lost. Please help
  3 comentarios
rayray
rayray el 26 de Abr. de 2018
My TA literally told me what to write and said that this was enough of a start for me to understand what to do and understand it all on my own. I do have a lot more of it but I am not sure if that would be a good idea for me to post all of it.
Geoff Hayes
Geoff Hayes el 26 de Abr. de 2018
Are you calling the buttonPress code from your pushbutton callbacks? (Or whatever controls you are using for the cells in the 3x3 board.)
I think that the above code is missing some logic - how do you know if you should draw an X or O? Why is the turnNumber one? What does this represent?

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by