function boggle
% Displays a boggle board
ndice = 25;
dice = ['ITITIE';'RISAYF';'SARAFA';'CIIETL';'MUAEGE';'IAFASR';'GVRRWO';'ONOWUT';'EEEEMA';'SSNSEU';'EAEAEE';'FSYRIP';'PCEILT';'NDLRDO';'GNAEMN';'HRLHOD';'LONDRH';'SPTECI';'TTTOEM';'HRRYPI';'ENNNDA';'NWCCTS';'OTHHDN';'OOTOTU';'XBKJQZ'];
Hfig = figure('PaperPosition',[0.25 0.875 8 9.25]);
for b = 1:4
axy = [ceil(b/2)-1,mod(b,2)];
%Haxis = axes('Units','inches','Position',[4.25 6.375].*axy,3.75,3.75],'XTick',[],'YTick',[]);
Haxis = axes('Position',[[0.53125 22/37].*axy,0.46875,15/37],'XTick',[],'YTick',[]);
hold on;
for i = 0:5
plot([0,1],[i/5,i/5],'k-');
plot([i/5,i/5],[0,1],'k-');
end;
% roll dice
[score,order] = sort(rand(1,ndice));
roll = floor(rand(1,25)*6)+1;
letter = dice((roll-1)*ndice+order);
for i = 1:5
for j = 1:5
lstring = letter((i-1)*5+j);
orient = floor(rand(1)*4);
if (lstring == 'Q')
lstring = 'Qu';
elseif (lstring == 'N')||(lstring == 'Z')||(lstring == 'M')||(lstring == 'W')
switch orient
case 0
plot([0.2*i-0.14,0.2*i-0.06],[0.2*j-0.16,0.2*j-0.16],'k-','LineWidth',2);
case 1
plot([0.2*i-0.04,0.2*i-0.04],[0.2*j-0.14,0.2*j-0.06],'k-','LineWidth',2);
case 2
plot([0.2*i-0.14,0.2*i-0.06],[0.2*j-0.04,0.2*j-0.04],'k-','LineWidth',2);
case 3
plot([0.2*i-0.16,0.2*i-0.16],[0.2*j-0.14,0.2*j-0.06],'k-','LineWidth',2);
end;
end;
Htext = text(0.2*i-0.1,0.2*j-0.1,lstring,'FontName','arial','HorizontalAlignment','center','VerticalAlignment','middle','Rotation',90*orient,'FontSize',36);
end;
end;
end;