%addPoints2.m
%addPoints2 is called by the GUI "cribScoreBoard". It is the callback
%function for when the "Add" button is clicked for player 2.
set(player2,'toAdd',str2num(get(Splayer2Input,'String'))); %Establish what toAdd is
set(player2,'prevScore',get(player2,'score')); %Move the current score to the previous score
set(player2,'score',get(player2,'prevScore') + get(player2,'toAdd')); %Calculate and set the new score.
currentPlayer = player2; %Used in winnerGui
otherPlayer = player1; %Used in winnerGui
winnerGui; %Check to see if the game is over.
%% Update the scoreboard GUI
set(Splayer2Score,'String',num2str(get(player2,'score'))); % Score
set(Splayer2Input,'String',num2str(1)); %Reset the input to 1
set(Splayer2PrevScore,'String',num2str(get(player2,'prevScore'))); %prevScore
set(Splayer2JustAdded,'String',num2str(get(player2,'toAdd'))); %Just Added