%   Filename: TTTWhoGoesFirst.m
%   Description:
%       This script is called when the WhoGoesFirstCheckBox is checked or
%   unchecked.
%       If a game is running, it prompts the user if they want to start a
%   new game with their new setting.
%       If a game is not running and the box is checked, it'll call the
%   computer to move first to start the game.
%
%   Variables:
%       WhoGoesFirstConfirmation, integer, temporary variable to store
%           choice from who goes first menu.
%       StartNewGame, boolean, keeps track of whether or not a new game
%           must be started because a current game is running
%       CurrentPlayer, string, keeps track of who's turn it is
%
%   Team DATT "All DATT and dim sum."
%   11/17/05

%'get(gcbo,'value')==1' means WhoGoesFirstCheckBox is checked

if StartNewGame == true
    WhoGoesFirstConfirmation = ...
        menu({'You chose a different player to go first.',...
        'Do you want to start a new game?',...
        'Note: This will result in a loss.'},'Yes','Cancel');
    
    if WhoGoesFirstConfirmation == 1
        if get(gcbo,'value')==1
            CurrentPlayer = 'Compu';
        else
            CurrentPlayer = 'Human';
        end
        
        StartNewGame = false;
        TTTStartGamePBCB
    end
else
    if get(gcbo,'value')==1
        CurrentPlayer = 'Compu';
    else
        CurrentPlayer = 'Human';
    end
    if get(gcbo,'value')==1
        TTTClickSquarePBCB
    end
end