%newGame.m
%newGame will start a brand new game.
%% If we want to keep playing with the same names, then do it!
if exist('player1')
prompt1 = questdlg('Use the same names?');
if isequal(prompt1,'Yes')
temp1 = get(player1,'name');
temp2 = get(player2,'name');
player1 = person;
player2 = person;
set(player1,'name',temp1);
set(player2,'name',temp2);
return
end
end
%% Otherwise, let's get the new names set up.
prompt = {'First Player:','Second Player:'};
dlg_title = 'Please enter your names: ';
num_lines = 1;
def = {'Player One','Player Two'};
answer = inputdlg(prompt,dlg_title,num_lines,def);
if size(answer) == 0
return
end
player1 = person;
player2 = person;
set(player1,'name',answer{1});
set(player2,'name',answer{2});