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.

cribHelpGui.m
%cribHelpGui.m
%cribHelpGui is the help GUI for CribbageSuite. It contains a lot of info
%on how CribbageSuite works, as well as a link to cribbage.org's instructions
%for cribbage play.

HhelpFig = figure; %Open a new figure.
set(HhelpFig,...
    'Menubar','none',...
    'NumberTitle','off',...
    'Name','Cribbage Suite Help',...
    'Position',[816   590   580   290]);

%Menu bar at the top of the GUI.
HhelpMenu = uimenu('Label','&File');
    HhelpMenuFile1 = uimenu(HhelpMenu,'Label','&Refresh','Callback','close gcf; cribHelpGui; ');
    HhelpMenuFile2 = uimenu(HhelpMenu,'Label','&Close','Callback','close gcf');
    
%% Right side: Display of information
InitialText = 'Select a topic from the left; the help will be displayed here.                                                                                                             If you don''t know how to play cribbage at all, click on the blue button to open a webpage describing the game!';
Choose6Text = 'Choose6 allows you to input what 6 cards were drawn for you. Once you have selected the six cards, you may then hit "Choose 4" and the computer will choose the 4 cards that will maximize your counting hand. NOTE: These four cards are chosen without considering what you may want for the pegging round!';
Choose4Text = 'Enter in what 4 cards you decided to keep for your hand, as well as the starter card''s value and whether or not this is the crib. Hit "SCORE" to display the score at the bottom of the window. Statistics for the hand are displayed in the command window, and the score is loaded into the Scoreboard for easy addition.'; 
ScoreboardText = 'The Scoreboard is the digital version of a solid maple cribbage board. The sindow is split down the middle; each player has his own half. Your current score is displayed in bold at the bottom. To add points, enter in the number to be added in the text box, and hit ''Add''. The default amount is 1 point, so you can just click on the Add button as many times as you need to. If you made a mistake, just hit the ''Oops'' button to undo it. If you want to score your hand or get help choosing what cards to keep, choose those options from the File menu.';
ViewPlayerRecordText = 'The Head2Head is the ultimate comparison of two cribbage players. Input the two players you want to compare, and the multi-game score will be displayed for those two players. You can tell who got an early lead or who''s making a comeback. Bragging rights are now indisputable.';

HhelpDispPanel = uipanel(...
    'Parent',HhelpFig,...
    'Position',[0.3 0 0.7 1]);
HhelpDispText = uicontrol(...
    'Style','text',...
    'Parent',HhelpDispPanel,...
    'String',InitialText,...
    'Units','normalized',...
    'Position',[0 0 1 1],...
    'FontUnits','points',...
    'FontSize',12,...
    'HorizontalAlignment','left');

%% Left side button panel for choosing help topic.
HhelpTopics = uibuttongroup(...
    'Position',[0 0 .3 1],...
    'Title','Choose a Help Topic',...
    'Visible','on',...
    'Parent',HhelpFig,...
    'FontWeight','bold');
Hchoose6 = uicontrol(...
    'Parent',HhelpTopics,...
    'String','Choose 6 Cards',...
    'Style','pushbutton',...
    'Position',[10 225 140 25],...
    'Callback','set(HhelpDispText,''String'',Choose6Text)');
Hchoose4 = uicontrol(...
    'Parent',HhelpTopics,...
    'String','Choose 4 Cards',...
    'Style','pushbutton',...
    'Position',[10 175 140 25],...
    'Callback','set(HhelpDispText,''String'',Choose4Text)');
Hscoreboard = uicontrol(...
    'Parent',HhelpTopics,...
    'String','Scoreboard',...
    'Style','pushbutton',...
    'Position',[10 125 140 25],...
    'Callback','set(HhelpDispText,''String'',ScoreboardText)');
HplayerBoard = uicontrol(...
    'Parent',HhelpTopics,...
    'String','View Player Record',...
    'Style','pushbutton',...
    'Position',[10 75 140 25],...
    'Callback','set(HhelpDispText,''String'',ViewPlayerRecordText)');
HrulesOfCribbage = uicontrol(...
    'Parent',HhelpTopics,...
    'String','Rules of Cribbage',...
    'Position',[10 25 140 25],...
    'Callback','web(''http://www.cribbage.org/rules'')',...
    'ForegroundColor','blue',...
    'FontWeight','bold');

Contact us at files@mathworks.com