Skip to content

Commit

Permalink
Added hint feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
twyatt committed May 17, 2011
1 parent ced6963 commit d2d4878
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 0 additions & 1 deletion boardColor.m
Expand Up @@ -25,4 +25,3 @@
output_args = true; output_args = true;


end end

17 changes: 17 additions & 0 deletions callbackHint.m
@@ -0,0 +1,17 @@
if (~boardIsFull(board))
[score, temp] = minimax(whosTurn, board, -inf, inf);
hint = temp - board;
[m, n] = find(hint ~= 0);
handle = getHandleForSquareAt(m, n);

if (whosTurn == 1)
char = 'X';
elseif (whosTurn == 2)
char = 'O';
end

set(handle, 'String', char);
set(handle, 'ForegroundColor', [0.6, 0.6, 0.6]);

clear score hint m n handle char; % clean up
end
Binary file modified game.fig
Binary file not shown.

0 comments on commit d2d4878

Please sign in to comment.