How to write a function that places pieces on a tictactoe board in a GUI.
조회 수: 1 (최근 30일)
이전 댓글 표시
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
Geoff Hayes
2018년 4월 26일
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?
답변 (0개)
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!