%   TTTDifficultyPBCB.m
%   Description: 
%       This script is run when the difficulty button is clicked.
%   This will ask the user if they want to start a new game if a game is
%   already running. This script will then ask the user what difficulty
%   they want the game to run at.
%
%   Variables:
%       GameOver, boolean, keeps track of whether the current game is over
%          or not
%       StartNewGame, boolean, keeps track of whether or not a new game
%           must be started because a current game is running
%       DifficultyLevelChoice, integer, temporary variable to store the
%          user's choice from the difficulty menu
%       DifficultyLevel, integer, keeps track of current difficulty
%       DifficultyCBPushed, boolean, confirmation for callback
%          TTTStartGamePBCB whether or not to run a computer move
%
%   Team DATT "All DATT and dim sum."
%   11/17/05

DifficultyCBPushed = true;

TTTNewGamePBCB

%Menu selection for difficulty
if (StartNewGame == false)&(GameOver==false)
    DifficultyLevelChoice = menu('Select your difficulty:','Easy','Hard','Cancel');
    switch DifficultyLevelChoice
        case 1
            DifficultyLevel = 1; %Easy
            set(findobj('tag','DifficultyPB'),'string', 'Easy')
        case 2
            DifficultyLevel = 2; %Hard
            set(findobj('tag','DifficultyPB'),'string', 'Hard')
    end

    %A new game is always started before difficulty choice, if the computer
    %is selected to go first, TTTClickSquarePBCB is called to make the
    %computer choose it's move.
    if get(findobj('tag','WhoGoesFirstCheckBox'),'value')==1
            TTTClickSquarePBCB
    end
end

DifficultyCBPushed = false;