Code covered by the BSD License  

Highlights from
Cribbage Suite

image thumbnail
from Cribbage Suite by Bryan
Cribbage Suite is a GUI interface designed to help teach and play the game of cribbage.

undo2.m
%undo2.m
%See undo1 for information.

set(player2,'toAdd',-get(player2,'toAdd')); %Make toAdd negative

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.

%% 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

Contact us at files@mathworks.com