function battleship(action)
% GUI version of BATTLESHIP board game
if nargin==0
action = 'create';
end
%###########################################################################################################################
if strcmp(action, 'create')
battle; % call to create base gui
% initialize chart
filled = [0,0,0,0,0,0,0,0,0,0,...
0,0,0,0,0,0,0,0,0,0,...
0,0,0,0,0,0,0,0,0,0,...
0,0,0,0,0,0,0,0,0,0,...
0,0,0,0,0,0,0,0,0,0,...
0,0,0,0,0,0,0,0,0,0,...
0,0,0,0,0,0,0,0,0,0,...
0,0,0,0,0,0,0,0,0,0,...
0,0,0,0,0,0,0,0,0,0,...
0,0,0,0,0,0,0,0,0,0];
type = ['M','M','M','M','M','M','M','M','M','M',...
'M','M','M','M','M','M','M','M','M','M',...
'M','M','M','M','M','M','M','M','M','M',...
'M','M','M','M','M','M','M','M','M','M',...
'M','M','M','M','M','M','M','M','M','M',...
'M','M','M','M','M','M','M','M','M','M',...
'M','M','M','M','M','M','M','M','M','M',...
'M','M','M','M','M','M','M','M','M','M',...
'M','M','M','M','M','M','M','M','M','M',...
'M','M','M','M','M','M','M','M','M','M'];
% Hide five ships over the 10x10 grid, only one ship can occupy any particular square.
% Ships:
%
% Destroyer - 2 blocks
% Submarine - 3 blocks
% Cruiser - 3 blocks
% Battleship - 4 blocks
% Aircraft Carrier - 5 blocks
%
% Sample placement:
% 1 2 3 4 5 6 7 8 9 10
% A X X X X X D X X X X
% B X X X X X D X X X X
% C B B B B X X X X X X
% D C X X X X X X X X X
% E X C X X X X X X X X
% F X X C X X X X X S X
% G X X X X X X X S X X
% H X X X X X X S X X X
% I X X X X X X X X X X
% J X X X X A A A A A X
%
% Placement can be horizontal, diagonal or vertical
%
% Aircraft Carrier
% Get Single Random Starting Point
astart = rand(1);
astart = 100*astart;
astart = astart - mod(astart,1);
% Get direction
direction = rand(1);
if direction > .6667
direction = 'horizontal';
elseif direction > .3333
direction = 'vertical';
elseif direction > .1667
direction = 'diagonal_up_slope';
else
direction = 'diagonal_down_slope';
end
if strcmp(direction,'horizontal') == 1
apoint1 = astart + 1;
apoint2 = astart + 2;
apoint3 = astart + 3;
apoint4 = astart + 4;
if mod(apoint4,10) < 5 & mod(apoint4,10) > 0 % Ran off the end of the plot
apoint1 = astart - 1;
apoint2 = astart - 2;
apoint3 = astart - 3;
apoint4 = astart - 4;
end
elseif strcmp(direction,'vertical') == 1
apoint1 = astart + 10;
apoint2 = apoint1 + 10;
apoint3 = apoint2 + 10;
apoint4 = apoint3 + 10;
if apoint4 > 100
apoint1 = astart - 10;
apoint2 = apoint1 - 10;
apoint3 = apoint2 - 10;
apoint4 = apoint3 - 10;
end
elseif strcmp(direction,'diagonal_up_slope') == 1
if astart < 41
apoint1 = astart + 9; % must reverse direction
apoint2 = apoint1 + 9;
apoint3 = apoint2 + 9;
apoint4 = apoint3 + 9;
if mod(astart,10) < 5 & mod(astart,10) > 0
apoint1 = astart + 11; % must change to down slope
apoint2 = apoint1 + 11;
apoint3 = apoint2 + 11;
apoint4 = apoint3 + 11;
end
else
apoint1 = astart - 9;
apoint2 = apoint1 - 9;
apoint3 = apoint2 - 9;
apoint4 = apoint3 - 9;
if mod(astart,10) > 6 | mod(astart,10) == 0
apoint1 = astart + 9;
apoint2 = apoint1 + 9;
apoint3 = apoint2 + 9;
apoint4 = apoint3 + 9;
if astart > 66
apoint1 = astart - 11;
apoint2 = apoint1 - 11;
apoint3 = apoint2 - 11;
apoint4 = apoint3 - 11;
end
end
end
else % diagonal down_slope
if astart > 60
apoint1 = astart - 11; % must reverse direction
apoint2 = apoint1 - 11;
apoint3 = apoint2 - 11;
apoint4 = apoint3 - 11;
if mod(astart,10) < 5 & mod(astart,10) > 0
apoint1 = astart - 9; % must change to down slope
apoint2 = apoint1 - 9;
apoint3 = apoint2 - 9;
apoint4 = apoint3 - 9;
end
else
apoint1 = astart + 11;
apoint2 = apoint1 + 11;
apoint3 = apoint2 + 11;
apoint4 = apoint3 + 11;
if mod(astart,10) > 6 | mod(astart,10) == 0
apoint1 = astart - 11;
apoint2 = apoint1 - 11;
apoint3 = apoint2 - 11;
apoint4 = apoint3 - 11;
if astart < 41
apoint1 = astart + 9;
apoint2 = apoint1 + 9;
apoint3 = apoint2 + 9;
apoint4 = apoint3 + 9;
end
end
end
end
filled(astart) = 1;
filled(apoint1) = 1;
filled(apoint2) = 1;
filled(apoint3) = 1;
filled(apoint4) = 1;
type(astart) = 'A';
type(apoint1) = 'A';
type(apoint2) = 'A';
type(apoint3) = 'A';
type(apoint4) = 'A';
% Battleship
start_again = 1;
while start_again == 1
xx = 'a';
while strcmp(xx,'a') == 1
bstart = rand(1);
bstart = 100*bstart;
bstart = bstart - mod(bstart,1);
if filled(bstart) == 0
xx = 'b';
end
end
% Get direction
direction = rand(1);
if direction > .6667
direction = 'horizontal';
elseif direction > .3333
direction = 'vertical';
elseif direction > .1667
direction = 'diagonal_up_slope';
else
direction = 'diagonal_down_slope';
end
if strcmp(direction,'horizontal') == 1
bpoint1 = bstart + 1;
bpoint2 = bstart + 2;
bpoint3 = bstart + 3;
if mod(bpoint3,10) < 4 & mod(bpoint3,10) > 0 % Ran off the end of the plot
bpoint1 = bstart - 1;
bpoint2 = bstart - 2;
bpoint3 = bstart - 3;
end
elseif strcmp(direction,'vertical') == 1
bpoint1 = bstart + 10;
bpoint2 = bpoint1 + 10;
bpoint3 = bpoint2 + 10;
if bpoint3 > 100
bpoint1 = bstart - 10;
bpoint2 = bpoint1 - 10;
bpoint3 = bpoint2 - 10;
end
elseif strcmp(direction,'diagonal_up_slope') == 1
if bstart < 31
bpoint1 = bstart + 9; % must reverse direction
bpoint2 = bpoint1 + 9;
bpoint3 = bpoint2 + 9;
if mod(bstart,10) < 4 & mod(bstart,10) > 0
bpoint1 = bstart + 11; % must change to down slope
bpoint2 = bpoint1 + 11;
bpoint3 = bpoint2 + 11;
end
else
bpoint1 = bstart - 9;
bpoint2 = bpoint1 - 9;
bpoint3 = bpoint2 - 9;
if mod(bstart,10) > 7 | mod(bstart,10) == 0
bpoint1 = bstart + 9;
bpoint2 = bpoint1 + 9;
bpoint3 = bpoint2 + 9;
if bstart > 77
bpoint1 = bstart - 11;
bpoint2 = bpoint1 - 11;
bpoint3 = bpoint2 - 11;
end
end
end
else % diagonal down_slope
if bstart > 70
bpoint1 = bstart - 11; % must reverse direction
bpoint2 = bpoint1 - 11;
bpoint3 = bpoint2 - 11;
if mod(bstart,10) < 4 & mod(bstart,10) > 0
bpoint1 = bstart - 9; % must change to down slope
bpoint2 = bpoint1 - 9;
bpoint3 = bpoint2 - 9;
end
else
bpoint1 = bstart + 11 ;
bpoint2 = bpoint1 + 11;
bpoint3 = bpoint2 + 11;
if mod(bstart,10) > 7 | mod(bstart,10) == 0
bpoint1 = bstart - 11;
bpoint2 = bpoint1 - 11;
bpoint3 = bpoint2 - 11;
if bstart < 31
bpoint1 = bstart + 9;
bpoint2 = bpoint1 + 9;
bpoint3 = bpoint2 + 9;
end
end
end
end
if filled(bpoint1) == 1 | filled(bpoint2) == 1 | filled(bpoint3) == 1
start_again = 1;
else
start_again = 0;
filled(bstart) = 1;
filled(bpoint1) = 1;
filled(bpoint2) = 1;
filled(bpoint3) = 1;
type(bstart) = 'B';
type(bpoint1) = 'B';
type(bpoint2) = 'B';
type(bpoint3) = 'B';
end
end
% Cruiser
start_again = 1;
while start_again == 1
xx = 'a';
while strcmp(xx,'a') == 1
cstart = rand(1);
cstart = 100*cstart;
cstart = cstart - mod(cstart,1);
if filled(cstart) == 0
xx = 'b';
end
end
% Get direction
direction = rand(1);
if direction > .6667
direction = 'horizontal';
elseif direction > .3333
direction = 'vertical';
elseif direction > .1667
direction = 'diagonal_up_slope';
else
direction = 'diagonal_down_slope';
end
if strcmp(direction,'horizontal') == 1
cpoint1 = cstart + 1;
cpoint2 = cstart + 2;
if mod(cpoint2,10) < 3 & mod(cpoint2,10) > 0 % Ran off the end of the plot
cpoint1 = cstart - 1;
cpoint2 = cstart - 2;
end
elseif strcmp(direction,'vertical') == 1
cpoint1 = cstart + 10;
cpoint2 = cpoint1 + 10;
if cpoint2 > 100
cpoint1 = cstart - 10;
cpoint2 = cpoint1 - 10;
end
elseif strcmp(direction,'diagonal_up_slope') == 1
if cstart < 21
cpoint1 = cstart + 9; % must reverse direction
cpoint2 = cpoint1 + 9;
if mod(cstart,10) < 3 & mod(cstart,10) > 0
cpoint1 = cstart + 11; % must change to down slope
cpoint2 = cpoint1 + 11;
end
else
cpoint1 = cstart - 9;
cpoint2 = cpoint1 - 9;
if mod(cstart,10) > 8 | mod(cstart,10) == 0
cpoint1 = cstart + 9;
cpoint2 = cpoint1 + 9;
if cstart > 88
cpoint1 = cstart - 11;
cpoint2 = cpoint1 - 11;
end
end
end
else % diagonal down_slope
if cstart > 80
cpoint1 = cstart - 11; % must reverse direction
cpoint2 = cpoint1 - 11;
if mod(cstart,10) < 3 & mod(cstart,10) > 0
cpoint1 = cstart - 9; % must change to down slope
cpoint2 = cpoint1 - 9;
end
else
cpoint1 = cstart + 11 ;
cpoint2 = cpoint1 + 11;
if mod(cstart,10) > 8 | mod(cstart,10) == 0
cpoint1 = cstart - 11;
cpoint2 = cpoint1 - 11;
if cstart < 21
cpoint1 = cstart + 9;
cpoint2 = cpoint1 + 9;
end
end
end
end
if filled(cpoint1) == 1 | filled(cpoint2) == 1
start_again = 1;
else
start_again = 0;
filled(cstart) = 1;
filled(cpoint1) = 1;
filled(cpoint2) = 1;
type(cstart) = 'C';
type(cpoint1) = 'C';
type(cpoint2) = 'C';
end
end
% Submarine
start_again = 1;
while start_again == 1
xx = 'a';
while strcmp(xx,'a') == 1
sstart = rand(1);
sstart = 100*sstart;
sstart = sstart - mod(sstart,1);
if filled(sstart) == 0
xx = 'b';
end
end
% Get direction
direction = rand(1);
if direction > .6667
direction = 'horizontal';
elseif direction > .3333
direction = 'vertical';
elseif direction > .1667
direction = 'diagonal_up_slope';
else
direction = 'diagonal_down_slope';
end
if strcmp(direction,'horizontal') == 1
spoint1 = sstart + 1;
spoint2 = sstart + 2;
if mod(spoint2,10) < 3 & mod(spoint2,10) > 0 % Ran off the end of the plot
spoint1 = sstart - 1;
spoint2 = sstart - 2;
end
elseif strcmp(direction,'vertical') == 1
spoint1 = sstart + 10;
spoint2 = spoint1 + 10;
if spoint2 > 100
spoint1 = sstart - 10;
spoint2 = spoint1 - 10;
end
elseif strcmp(direction,'diagonal_up_slope') == 1
if sstart < 21
spoint1 = sstart + 9; % must reverse direction
spoint2 = spoint1 + 9;
if mod(sstart,10) < 3 & mod(sstart,10) > 0
spoint1 = sstart + 11; % must change to down slope
spoint2 = spoint1 + 11;
end
else
spoint1 = sstart - 9;
spoint2 = spoint1 - 9;
if mod(sstart,10) > 8 | mod(sstart,10) == 0
spoint1 = sstart + 9;
spoint2 = spoint1 + 9;
if sstart > 88
spoint1 = sstart - 11;
spoint2 = spoint1 - 11;
end
end
end
else % diagonal down_slope
if sstart > 80
spoint1 = sstart - 11; % must reverse direction
spoint2 = spoint1 - 11;
if mod(sstart,10) < 3 & mod(sstart,10) > 0
spoint1 = sstart - 9; % must change to down slope
spoint2 = spoint1 - 9;
end
else
spoint1 = sstart + 11 ;
spoint2 = spoint1 + 11;
if mod(sstart,10) > 8 | mod(sstart,10) == 0
spoint1 = sstart - 11;
spoint2 = spoint1 - 11;
if bstart < 21
spoint1 = sstart + 9;
spoint2 = spoint1 + 9;
end
end
end
end
if filled(spoint1) == 1 | filled(spoint2) == 1
start_again = 1;
else
start_again = 0;
filled(sstart) = 1;
filled(spoint1) = 1;
filled(spoint2) = 1;
type(sstart) = 'S';
type(spoint1) = 'S';
type(spoint2) = 'S';
end
end
% Destroyer
start_again = 1;
while start_again == 1
xx = 'a';
while strcmp(xx,'a') == 1
dstart = rand(1);
dstart = 100*dstart;
dstart = dstart - mod(dstart,1);
if filled(dstart) == 0
xx = 'b';
end
end
% Get direction
direction = rand(1);
if direction > .6667
direction = 'horizontal';
elseif direction > .3333
direction = 'vertical';
elseif direction > .1667
direction = 'diagonal_up_slope';
else
direction = 'diagonal_down_slope';
end
if strcmp(direction,'horizontal') == 1
dpoint1 = dstart + 1;
if mod(dpoint1,10) == 1 % Ran off the end of the plot
dpoint1 = dstart - 1;
end
elseif strcmp(direction,'vertical') == 1
dpoint1 = dstart + 10;
if dpoint1 > 100
dpoint1 = dstart - 10;
end
elseif strcmp(direction,'diagonal_up_slope') == 1
if dstart < 11
dpoint1 = dstart + 9; % must reverse direction
if dstart == 1
dpoint1 = 12; % must change to down slope
end
else
dpoint1 = dstart - 9;
if mod(dstart,10) == 0
dpoint1 = dstart + 9;
if dstart == 100
dpoint1 = 89;
end
end
end
else % diagonal down_slope
if dstart > 90
dpoint1 = dstart - 11; % must reverse direction
if dstart == 91
dpoint1 = 82; % must change to down slope
end
else
dpoint1 = dstart + 11 ;
if mod(dstart,10) == 0
dpoint1 = dstart - 11;
if dstart == 10
dpoint1 = 19;
end
end
end
end
if filled(dpoint1) == 1
start_again = 1;
else
start_again = 0;
filled(dstart) = 1;
filled(dpoint1) = 1;
type(dstart) = 'D';
type(dpoint1) = 'D';
end
end
for z = 1:100
if filled(z) == 1
color = ['[1 0 0]'];
else
color = ['[1 1 1]'];
end
button = ['bs_pushbutton',num2str(z)];
set(findobj('tag',button),'Userdata',str2num(color));
set(findobj('tag','bs_bar'),'Userdata',type);
set(findobj('tag','bs_a'),'Userdata',5);
set(findobj('tag','bs_b'),'Userdata',4);
set(findobj('tag','bs_c'),'Userdata',3);
set(findobj('tag','bs_d'),'Userdata',2);
set(findobj('tag','bs_s'),'Userdata',3);
end
% Set initial color for each button to GRAY (real color hidden until user clicks on a button)
for x = 1:100
button = ['bs_pushbutton',num2str(x)];
set(findobj('tag',button),'BackgroundColor',[0.7 0.7 0.7]);
end
end
%###########################################################################################################################
if isempty(findobj('tag','bs')) % if program is closed down while running
return
end
%###########################################################################################################################
if strcmp(action,'quit') % Exit the Game
close(findobj('tag','bs')); % Close down the GUI
close all;
return;
end
%###########################################################################################################################
if strcmp(action, 'start_over')
% set all background colors back to gray
for x = 1:100
button = ['bs_pushbutton',num2str(x)];
set(findobj('tag',button),'BackgroundColor',[0.7 0.7 0.7]);
set(findobj('tag',button),'Visible','on');
end
set(findobj('tag','bs_hit_miss'),'Userdata',17);
set(findobj('tag','bs_num_moves'),'String','0');
set(findobj('tag','bs_num_moves'),'Userdata',0);
set(findobj('tag','bs_instructions'),'String','Good luck!');
% re-jumble all the warships
filled = [0,0,0,0,0,0,0,0,0,0,...
0,0,0,0,0,0,0,0,0,0,...
0,0,0,0,0,0,0,0,0,0,...
0,0,0,0,0,0,0,0,0,0,...
0,0,0,0,0,0,0,0,0,0,...
0,0,0,0,0,0,0,0,0,0,...
0,0,0,0,0,0,0,0,0,0,...
0,0,0,0,0,0,0,0,0,0,...
0,0,0,0,0,0,0,0,0,0,...
0,0,0,0,0,0,0,0,0,0];
type = ['M','M','M','M','M','M','M','M','M','M',...
'M','M','M','M','M','M','M','M','M','M',...
'M','M','M','M','M','M','M','M','M','M',...
'M','M','M','M','M','M','M','M','M','M',...
'M','M','M','M','M','M','M','M','M','M',...
'M','M','M','M','M','M','M','M','M','M',...
'M','M','M','M','M','M','M','M','M','M',...
'M','M','M','M','M','M','M','M','M','M',...
'M','M','M','M','M','M','M','M','M','M',...
'M','M','M','M','M','M','M','M','M','M'];
%
% Aircraft Carrier
% Get Single Random Starting Point
astart = rand(1);
astart = 100*astart;
astart = astart - mod(astart,1);
% Get direction
direction = rand(1);
if direction > .6667
direction = 'horizontal';
elseif direction > .3333
direction = 'vertical';
elseif direction > .1667
direction = 'diagonal_up_slope';
else
direction = 'diagonal_down_slope';
end
if strcmp(direction,'horizontal') == 1
apoint1 = astart + 1;
apoint2 = astart + 2;
apoint3 = astart + 3;
apoint4 = astart + 4;
if mod(apoint4,10) < 5 & mod(apoint4,10) > 0 % Ran off the end of the plot
apoint1 = astart - 1;
apoint2 = astart - 2;
apoint3 = astart - 3;
apoint4 = astart - 4;
end
elseif strcmp(direction,'vertical') == 1
apoint1 = astart + 10;
apoint2 = apoint1 + 10;
apoint3 = apoint2 + 10;
apoint4 = apoint3 + 10;
if apoint4 > 100
apoint1 = astart - 10;
apoint2 = apoint1 - 10;
apoint3 = apoint2 - 10;
apoint4 = apoint3 - 10;
end
elseif strcmp(direction,'diagonal_up_slope') == 1
if astart < 41
apoint1 = astart + 9; % must reverse direction
apoint2 = apoint1 + 9;
apoint3 = apoint2 + 9;
apoint4 = apoint3 + 9;
if mod(astart,10) < 5 & mod(astart,10) > 0
apoint1 = astart + 11; % must change to down slope
apoint2 = apoint1 + 11;
apoint3 = apoint2 + 11;
apoint4 = apoint3 + 11;
end
else
apoint1 = astart - 9;
apoint2 = apoint1 - 9;
apoint3 = apoint2 - 9;
apoint4 = apoint3 - 9;
if mod(astart,10) > 6 | mod(astart,10) == 0
apoint1 = astart + 9;
apoint2 = apoint1 + 9;
apoint3 = apoint2 + 9;
apoint4 = apoint3 + 9;
if astart > 66
apoint1 = astart - 11;
apoint2 = apoint1 - 11;
apoint3 = apoint2 - 11;
apoint4 = apoint3 - 11;
end
end
end
else % diagonal down_slope
if astart > 60
apoint1 = astart - 11; % must reverse direction
apoint2 = apoint1 - 11;
apoint3 = apoint2 - 11;
apoint4 = apoint3 - 11;
if mod(astart,10) < 5 & mod(astart,10) > 0
apoint1 = astart - 9; % must change to down slope
apoint2 = apoint1 - 9;
apoint3 = apoint2 - 9;
apoint4 = apoint3 - 9;
end
else
apoint1 = astart + 11;
apoint2 = apoint1 + 11;
apoint3 = apoint2 + 11;
apoint4 = apoint3 + 11;
if mod(astart,10) > 6 | mod(astart,10) == 0
apoint1 = astart - 11;
apoint2 = apoint1 - 11;
apoint3 = apoint2 - 11;
apoint4 = apoint3 - 11;
if astart < 41
apoint1 = astart + 9;
apoint2 = apoint1 + 9;
apoint3 = apoint2 + 9;
apoint4 = apoint3 + 9;
end
end
end
end
filled(astart) = 1;
filled(apoint1) = 1;
filled(apoint2) = 1;
filled(apoint3) = 1;
filled(apoint4) = 1;
type(astart) = 'A';
type(apoint1) = 'A';
type(apoint2) = 'A';
type(apoint3) = 'A';
type(apoint4) = 'A';
% Battleship
start_again = 1;
while start_again == 1
xx = 'a';
while strcmp(xx,'a') == 1
bstart = rand(1);
bstart = 100*bstart;
bstart = bstart - mod(bstart,1);
if filled(bstart) == 0
xx = 'b';
end
end
% Get direction
direction = rand(1);
if direction > .6667
direction = 'horizontal';
elseif direction > .3333
direction = 'vertical';
elseif direction > .1667
direction = 'diagonal_up_slope';
else
direction = 'diagonal_down_slope';
end
if strcmp(direction,'horizontal') == 1
bpoint1 = bstart + 1;
bpoint2 = bstart + 2;
bpoint3 = bstart + 3;
if mod(bpoint3,10) < 4 & mod(bpoint3,10) > 0 % Ran off the end of the plot
bpoint1 = bstart - 1;
bpoint2 = bstart - 2;
bpoint3 = bstart - 3;
end
elseif strcmp(direction,'vertical') == 1
bpoint1 = bstart + 10;
bpoint2 = bpoint1 + 10;
bpoint3 = bpoint2 + 10;
if bpoint3 > 100
bpoint1 = bstart - 10;
bpoint2 = bpoint1 - 10;
bpoint3 = bpoint2 - 10;
end
elseif strcmp(direction,'diagonal_up_slope') == 1
if bstart < 31
bpoint1 = bstart + 9; % must reverse direction
bpoint2 = bpoint1 + 9;
bpoint3 = bpoint2 + 9;
if mod(bstart,10) < 4 & mod(bstart,10) > 0
bpoint1 = bstart + 11; % must change to down slope
bpoint2 = bpoint1 + 11;
bpoint3 = bpoint2 + 11;
end
else
bpoint1 = bstart - 9;
bpoint2 = bpoint1 - 9;
bpoint3 = bpoint2 - 9;
if mod(bstart,10) > 7 | mod(bstart,10) == 0
bpoint1 = bstart + 9;
bpoint2 = bpoint1 + 9;
bpoint3 = bpoint2 + 9;
if bstart > 77
bpoint1 = bstart - 11;
bpoint2 = bpoint1 - 11;
bpoint3 = bpoint2 - 11;
end
end
end
else % diagonal down_slope
if bstart > 70
bpoint1 = bstart - 11; % must reverse direction
bpoint2 = bpoint1 - 11;
bpoint3 = bpoint2 - 11;
if mod(bstart,10) < 4 & mod(bstart,10) > 0
bpoint1 = bstart - 9; % must change to down slope
bpoint2 = bpoint1 - 9;
bpoint3 = bpoint2 - 9;
end
else
bpoint1 = bstart + 11 ;
bpoint2 = bpoint1 + 11;
bpoint3 = bpoint2 + 11;
if mod(bstart,10) > 7 | mod(bstart,10) == 0
bpoint1 = bstart - 11;
bpoint2 = bpoint1 - 11;
bpoint3 = bpoint2 - 11;
if bstart < 31
bpoint1 = bstart + 9;
bpoint2 = bpoint1 + 9;
bpoint3 = bpoint2 + 9;
end
end
end
end
if filled(bpoint1) == 1 | filled(bpoint2) == 1 | filled(bpoint3) == 1
start_again = 1;
else
start_again = 0;
filled(bstart) = 1;
filled(bpoint1) = 1;
filled(bpoint2) = 1;
filled(bpoint3) = 1;
type(bstart) = 'B';
type(bpoint1) = 'B';
type(bpoint2) = 'B';
type(bpoint3) = 'B';
end
end
% Cruiser
start_again = 1;
while start_again == 1
xx = 'a';
while strcmp(xx,'a') == 1
cstart = rand(1);
cstart = 100*cstart;
cstart = cstart - mod(cstart,1);
if filled(cstart) == 0
xx = 'b';
end
end
% Get direction
direction = rand(1);
if direction > .6667
direction = 'horizontal';
elseif direction > .3333
direction = 'vertical';
elseif direction > .1667
direction = 'diagonal_up_slope';
else
direction = 'diagonal_down_slope';
end
if strcmp(direction,'horizontal') == 1
cpoint1 = cstart + 1;
cpoint2 = cstart + 2;
if mod(cpoint2,10) < 3 & mod(cpoint2,10) > 0 % Ran off the end of the plot
cpoint1 = cstart - 1;
cpoint2 = cstart - 2;
end
elseif strcmp(direction,'vertical') == 1
cpoint1 = cstart + 10;
cpoint2 = cpoint1 + 10;
if cpoint2 > 100
cpoint1 = cstart - 10;
cpoint2 = cpoint1 - 10;
end
elseif strcmp(direction,'diagonal_up_slope') == 1
if cstart < 21
cpoint1 = cstart + 9; % must reverse direction
cpoint2 = cpoint1 + 9;
if mod(cstart,10) < 3 & mod(cstart,10) > 0
cpoint1 = cstart + 11; % must change to down slope
cpoint2 = cpoint1 + 11;
end
else
cpoint1 = cstart - 9;
cpoint2 = cpoint1 - 9;
if mod(cstart,10) > 8 | mod(cstart,10) == 0
cpoint1 = cstart + 9;
cpoint2 = cpoint1 + 9;
if cstart > 88
cpoint1 = cstart - 11;
cpoint2 = cpoint1 - 11;
end
end
end
else % diagonal down_slope
if cstart > 80
cpoint1 = cstart - 11; % must reverse direction
cpoint2 = cpoint1 - 11;
if mod(cstart,10) < 3 & mod(cstart,10) > 0
cpoint1 = cstart - 9; % must change to down slope
cpoint2 = cpoint1 - 9;
end
else
cpoint1 = cstart + 11 ;
cpoint2 = cpoint1 + 11;
if mod(cstart,10) > 8 | mod(cstart,10) == 0
cpoint1 = cstart - 11;
cpoint2 = cpoint1 - 11;
if cstart < 21
cpoint1 = cstart + 9;
cpoint2 = cpoint1 + 9;
end
end
end
end
if filled(cpoint1) == 1 | filled(cpoint2) == 1
start_again = 1;
else
start_again = 0;
filled(cstart) = 1;
filled(cpoint1) = 1;
filled(cpoint2) = 1;
type(cstart) = 'C';
type(cpoint1) = 'C';
type(cpoint2) = 'C';
end
end
% Submarine
start_again = 1;
while start_again == 1
xx = 'a';
while strcmp(xx,'a') == 1
sstart = rand(1);
sstart = 100*sstart;
sstart = sstart - mod(sstart,1);
if filled(sstart) == 0
xx = 'b';
end
end
% Get direction
direction = rand(1);
if direction > .6667
direction = 'horizontal';
elseif direction > .3333
direction = 'vertical';
elseif direction > .1667
direction = 'diagonal_up_slope';
else
direction = 'diagonal_down_slope';
end
if strcmp(direction,'horizontal') == 1
spoint1 = sstart + 1;
spoint2 = sstart + 2;
if mod(spoint2,10) < 3 & mod(spoint2,10) > 0 % Ran off the end of the plot
spoint1 = sstart - 1;
spoint2 = sstart - 2;
end
elseif strcmp(direction,'vertical') == 1
spoint1 = sstart + 10;
spoint2 = spoint1 + 10;
if spoint2 > 100
spoint1 = sstart - 10;
spoint2 = spoint1 - 10;
end
elseif strcmp(direction,'diagonal_up_slope') == 1
if sstart < 21
spoint1 = sstart + 9; % must reverse direction
spoint2 = spoint1 + 9;
if mod(sstart,10) < 3 & mod(sstart,10) > 0
spoint1 = sstart + 11; % must change to down slope
spoint2 = spoint1 + 11;
end
else
spoint1 = sstart - 9;
spoint2 = spoint1 - 9;
if mod(sstart,10) > 8 | mod(sstart,10) == 0
spoint1 = sstart + 9;
spoint2 = spoint1 + 9;
if sstart > 88
spoint1 = sstart - 11;
spoint2 = spoint1 - 11;
end
end
end
else % diagonal down_slope
if sstart > 80
spoint1 = sstart - 11; % must reverse direction
spoint2 = spoint1 - 11;
if mod(sstart,10) < 3 & mod(sstart,10) > 0
spoint1 = sstart - 9; % must change to down slope
spoint2 = spoint1 - 9;
end
else
spoint1 = sstart + 11 ;
spoint2 = spoint1 + 11;
if mod(sstart,10) > 8 | mod(sstart,10) == 0
spoint1 = sstart - 11;
spoint2 = spoint1 - 11;
if bstart < 21
spoint1 = sstart + 9;
spoint2 = spoint1 + 9;
end
end
end
end
if filled(spoint1) == 1 | filled(spoint2) == 1
start_again = 1;
else
start_again = 0;
filled(sstart) = 1;
filled(spoint1) = 1;
filled(spoint2) = 1;
type(sstart) = 'S';
type(spoint1) = 'S';
type(spoint2) = 'S';
end
end
% Destroyer
start_again = 1;
while start_again == 1
xx = 'a';
while strcmp(xx,'a') == 1
dstart = rand(1);
dstart = 100*dstart;
dstart = dstart - mod(dstart,1);
if filled(dstart) == 0
xx = 'b';
end
end
% Get direction
direction = rand(1);
if direction > .6667
direction = 'horizontal';
elseif direction > .3333
direction = 'vertical';
elseif direction > .1667
direction = 'diagonal_up_slope';
else
direction = 'diagonal_down_slope';
end
if strcmp(direction,'horizontal') == 1
dpoint1 = dstart + 1;
if mod(dpoint1,10) == 1 % Ran off the end of the plot
dpoint1 = dstart - 1;
end
elseif strcmp(direction,'vertical') == 1
dpoint1 = dstart + 10;
if dpoint1 > 100
dpoint1 = dstart - 10;
end
elseif strcmp(direction,'diagonal_up_slope') == 1
if dstart < 11
dpoint1 = dstart + 9; % must reverse direction
if dstart == 1
dpoint1 = 12; % must change to down slope
end
else
dpoint1 = dstart - 9;
if mod(dstart,10) == 0
dpoint1 = dstart + 9;
if dstart == 100
dpoint1 = 89;
end
end
end
else % diagonal down_slope
if dstart > 90
dpoint1 = dstart - 11; % must reverse direction
if dstart == 91
dpoint1 = 82; % must change to down slope
end
else
dpoint1 = dstart + 11 ;
if mod(dstart,10) == 0
dpoint1 = dstart - 11;
if dstart == 10
dpoint1 = 19;
end
end
end
end
if filled(dpoint1) == 1
start_again = 1;
else
start_again = 0;
filled(dstart) = 1;
filled(dpoint1) = 1;
type(dstart) = 'D';
type(dpoint1) = 'D';
end
end
for z = 1:100
if filled(z) == 1
color = ['[1 0 0]'];
else
color = ['[1 1 1]'];
end
button = ['bs_pushbutton',num2str(z)];
set(findobj('tag',button),'Userdata',str2num(color));
set(findobj('tag','bs_bar'),'Userdata',type);
set(findobj('tag','bs_a'),'Userdata',5);
set(findobj('tag','bs_b'),'Userdata',4);
set(findobj('tag','bs_c'),'Userdata',3);
set(findobj('tag','bs_d'),'Userdata',2);
set(findobj('tag','bs_s'),'Userdata',3);
end
end
%###########################################################################################################################
for x = 1:100
pushbutton_num = ['pushbutton',num2str(x)];
% User pushes a button... attempt to match up two buttons w/same color beneath
if strcmp(action, pushbutton_num)
% set background color
button = ['bs_pushbutton',num2str(x)];
color = get(findobj('tag',button),'Userdata');
total_moves = get(findobj('tag','bs_num_moves'),'Userdata');
%if color(1) == 0.7
total_moves = total_moves + 1;
%end
set(findobj('tag','bs_num_moves'),'Userdata',total_moves);
set(findobj('tag',button),'BackgroundColor',color);
% If background color is red
if color(1) == 1 & color(2) == 0 & color(3) == 0
set(findobj('tag','bs_hit_miss'),'String','Hit!');
hitmiss = get(findobj('tag','bs_bar'),'Userdata');
aship = get(findobj('tag','bs_a'),'Userdata');
bship = get(findobj('tag','bs_b'),'Userdata');
cship = get(findobj('tag','bs_c'),'Userdata');
dship = get(findobj('tag','bs_d'),'Userdata');
sship = get(findobj('tag','bs_s'),'Userdata');
if hitmiss(x) == 'A'
aship = aship - 1;
set(findobj('tag','bs_a'),'Userdata',aship);
elseif hitmiss(x) == 'B'
bship = bship - 1;
set(findobj('tag','bs_b'),'Userdata',bship);
elseif hitmiss(x) == 'C'
cship = cship - 1;
set(findobj('tag','bs_c'),'Userdata',cship);
elseif hitmiss(x) == 'D'
dship = dship - 1;
set(findobj('tag','bs_d'),'Userdata',dship);
else
sship = sship - 1;
set(findobj('tag','bs_s'),'Userdata',sship);
end
if aship == 0
set(findobj('tag','bs_hit_miss'),'String','Sunk Air Carrier!');
sunk_air = 10;
set(findobj('tag','bs_a'),'Userdata',sunk_air);
end
if bship == 0
set(findobj('tag','bs_hit_miss'),'String','Sunk Battleship!');
sunk_bat = 10;
set(findobj('tag','bs_b'),'Userdata',sunk_bat);
end
if cship == 0
set(findobj('tag','bs_hit_miss'),'String','Sunk Cruiser!');
sunk_cru = 10;
set(findobj('tag','bs_c'),'Userdata',sunk_cru);
end
if dship == 0
set(findobj('tag','bs_hit_miss'),'String','Sunk Destroyer!');
sunk_des = 10;
set(findobj('tag','bs_d'),'Userdata',sunk_des);
end
if sship == 0
set(findobj('tag','bs_hit_miss'),'String','Sunk Submarine!');
sunk_sub = 10;
set(findobj('tag','bs_s'),'Userdata',sunk_sub);
end
b = get(findobj('tag','bs_hit_miss'),'Userdata');
set(findobj('tag','bs_hit_miss'),'Userdata',b-1);
c = get(findobj('tag','bs_hit_miss'),'Userdata')
if c == 1
moves_final = str2num(get(findobj('tag','bs_num_moves'),'String'));
if moves_final < 35
set(findobj('tag','bs_instructions'),'String','At least half of your moves were correct! Ranking: Ace!!');
elseif moves_final < 45
set(findobj('tag','bs_instructions'),'String','You did it!! Ranking: Master!');
elseif moves_final < 55
set(findobj('tag','bs_instructions'),'String','You did it!! Ranking: Expert!');
elseif moves_final < 65
set(findobj('tag','bs_instructions'),'String','You did it!! Rating: Acceptable');
elseif moves_final < 75
set(findobj('tag','bs_instructions'),'String','You did it!! But you can do better! Ranking: Luckless!');
else
set(findobj('tag','bs_instructions'),'String','You did it, but... Ranking: Pathetic!');
end
end
else
set(findobj('tag','bs_hit_miss'),'String','Miss!');
end
set(findobj('tag','bs_num_moves'),'String',num2str(total_moves));
prev_button = get(findobj('tag','bs_start_over'),'Userdata');
prev_color = get(findobj('tag','bs_moves'),'Userdata');
end
end
%###########################################################################################################################
function fig = battle
% This is the machine-generated representation of a Handle Graphics object
% and its children. Note that handle values may change when these objects
% are re-created. This may cause problems with any callbacks written to
% depend on the value of the handle at the time the object was saved.
% This problem is solved by saving the output as a FIG-file.
%
% To reopen this object, just type the name of the M-file at the MATLAB
% prompt. The M-file and its associated MAT-file must be on your path.
%
% NOTE: certain newer features in MATLAB may not have been saved in this
% M-file due to limitations of this format, which has been superseded by
% FIG-files. Figures which have been annotated using the plot editor tools
% are incompatible with the M-file/MAT-file format, and should be saved as
% FIG-files.
mat0=[0,0,0;...
0,0,0;...
0,0,0;...
0,0,0;...
0,0,0;...
0,0,0;...
0,0,0;...
0,0,0;...
6.250000e-002,1.250000e-001,1.875000e-001;...
2.500000e-001,3.125000e-001,3.750000e-001;...
4.375000e-001,5.000000e-001,5.625000e-001;...
6.250000e-001,6.875000e-001,7.500000e-001;...
8.125000e-001,8.750000e-001,9.375000e-001;...
1,1,1;...
1,1,1;...
1,1,1;...
1,1,1;...
1,1,1;...
1,1,1;...
9.375000e-001,8.750000e-001,8.125000e-001;...
7.500000e-001,6.875000e-001,6.250000e-001;...
5.625000e-001,0,0;...
0,0,0;...
0,0,0;...
6.250000e-002,1.250000e-001,1.875000e-001;...
2.500000e-001,3.125000e-001,3.750000e-001;...
4.375000e-001,5.000000e-001,5.625000e-001;...
6.250000e-001,6.875000e-001,7.500000e-001;...
8.125000e-001,8.750000e-001,9.375000e-001;...
1,1,1;...
1,1,1;...
1,1,1;...
1,1,1;...
1,1,1;...
1,1,1;...
9.375000e-001,8.750000e-001,8.125000e-001;...
7.500000e-001,6.875000e-001,6.250000e-001;...
5.625000e-001,5.000000e-001,4.375000e-001;...
3.750000e-001,3.125000e-001,2.500000e-001;...
1.875000e-001,1.250000e-001,6.250000e-002;...
0,0,0;...
0,0,0;...
0,0,5.625000e-001;...
6.250000e-001,6.875000e-001,7.500000e-001;...
8.125000e-001,8.750000e-001,9.375000e-001;...
1,1,1;...
1,1,1;...
1,1,1;...
1,1,1;...
1,1,1;...
1,1,1;...
9.375000e-001,8.750000e-001,8.125000e-001;...
7.500000e-001,6.875000e-001,6.250000e-001;...
5.625000e-001,5.000000e-001,4.375000e-001;...
3.750000e-001,3.125000e-001,2.500000e-001;...
1.875000e-001,1.250000e-001,6.250000e-002;...
0,0,0;...
0,0,0;...
0,0,0;...
0,0,0;...
0,0,0;...
0,0,0;...
0,0,0;...
0,0,0];
h0 = figure('Units','points', ...
'Color',[1 1 1], ...
'Colormap',mat0, ...
'PaperPosition',[18 180 576 432], ...
'PaperUnits','points', ...
'Position',[150 70 492 470], ...
'Tag','bs', ...
'ToolBar','none');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[1 0 0], ...
'ListboxTop',0, ...
'Position',[10.5 440 472 20], ...
'FontName','Arial', ...
'FontSize',20, ...
'FontWeight','bold',...
'ForegroundColor',[0 0 0], ...
'String','\-==^~~|~~^==-/ B A T T L E S H I P \-==^~~|~~^==-/',...
'Style','text',...
'Tag','bs_text_title');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[1 1 1], ...
'FontName','Arial', ...
'FontSize',8, ...
'ListboxTop',0, ...
'HorizontalAlignment','left', ...
'Position',[10.5 405 172.5 30], ...
'String','Try to sink the five computer warships in as few moves as possible! Hits are red, misses are white.',...
'Style','text',...
'Tag','bs_instructions');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'Enable','off',...
'ListboxTop',0, ...
'ForegroundColor',[1 1 1], ...
'BackgroundColor',[0 0 0], ...
'Position',[190.5 406 37.5 14.25], ...
'Userdata',0,...
'String','0',...
'Style','edit',...
'Tag','bs_num_moves');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'ForegroundColor',[0 0 1], ...
'BackgroundColor',[1 1 1], ...
'Position',[190.5 420 37.5 12], ...
'String','Moves:',...
'Style','text',...
'Userdata',[0 0 0],...
'Tag','bs_moves');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'BackgroundColor',[0 0 0], ...
'Position',[235 406 72 28.5], ...
'FontWeight','bold', ...
'ForegroundColor',[0 1 1], ...
'Callback','battleship(''hit_miss'')', ...
'String','Welcome!',...
'Userdata',17,...
'Tag','bs_hit_miss');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'BackgroundColor',[1 1 0], ...
'Position',[312 406 83 28.5], ...
'FontWeight','bold',...
'Callback','battleship(''start_over'')', ...
'String','Start Over',...
'Userdata','bs_pushbutton0',...
'Tag','bs_start_over');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''quit'')', ...
'Position',[400 406 83 28.5], ...
'BackgroundColor',[1 0 0], ...
'FontWeight','bold',...
'String','QUIT',...
'Tag','bs_close(gcf)');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[1 0 0], ...
'ListboxTop',0, ...
'Position',[10.5 390 472 10], ...
'Style','text',...
'Tag','bs_bar');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[1 0 0], ...
'ListboxTop',0, ...
'Position',[11 40 442 343], ...
'Style','text',...
'Tag','bs_rbkgd');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0 0 1], ...
'ListboxTop',0, ...
'Position',[20 50 425 325], ...
'Style','text',...
'Tag','bs_bbkgd');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0 0 0], ...
'ListboxTop',0, ...
'Position',[190 180 84 65], ...
'Style','text',...
'Tag','bs_r2bkgd');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[1 0 0], ...
'ListboxTop',0, ...
'Position',[200 190 64 45], ...
'Style','text',...
'Tag','bs_r2bkgd');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Position',[10.5 355 37.5 28.5], ...
'String','A1',...
'Tag','bs_pushbutton1',...
'Visible','on',...
'Callback','battleship(''pushbutton1'')');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Position',[55.5 355 37.5 28.5], ...
'String','A2',...
'Tag','bs_pushbutton2',...
'Visible','on',...
'Callback','battleship(''pushbutton2'')');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Position',[100.5 355 37.5 28.5], ...
'Callback','battleship(''pushbutton3'')', ...
'String','A3', ...
'Visible','on',...
'Tag','bs_pushbutton3');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton4'')', ...
'Position',[145.5 355 37.5 28.5], ...
'String','A4', ...
'Visible','on',...
'Tag','bs_pushbutton4');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton5'')', ...
'Position',[190.5 355 37.5 28.5], ...
'String','A5',...
'Visible','on',...
'Tag','bs_pushbutton5');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton6'')', ...
'Position',[235.5 355 37.5 28.5], ...
'String','A6',...
'Visible','on',...
'Tag','bs_pushbutton6');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton7'')', ...
'Position',[280.5 355 37.5 28.5], ...
'String','A7',...
'Visible','on',...
'Tag','bs_pushbutton7');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton8'')', ...
'Position',[325.5 355 37.5 28.5], ...
'String','A8',...
'Visible','on',...
'Tag','bs_pushbutton8');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton9'')', ...
'Position',[370.5 355 37.5 28.5], ...
'String','A9',...
'Visible','on',...
'Tag','bs_pushbutton9');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton10'')', ...
'Position',[415.5 355 37.5 28.5], ...
'String','A10',...
'Visible','on',...
'Tag','bs_pushbutton10');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton11'')', ...
'Position',[10.5 320 37.5 28.5], ...
'String','B1',...
'Visible','on',...
'Tag','bs_pushbutton11');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton12'')', ...
'Position',[55.5 320 37.5 28.5], ...
'String','B2',...
'Visible','on',...
'Tag','bs_pushbutton12');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton13'')', ...
'Position',[100.5 320 37.5 28.5], ...
'String','B3', ...
'Visible','on',...
'Tag','bs_pushbutton13');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton14'')', ...
'Position',[145.5 320 37.5 28.5], ...
'String','B4', ...
'Visible','on',...
'Tag','bs_pushbutton14');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton15'')', ...
'Position',[190.5 320 37.5 28.5], ...
'String','B5',...
'Visible','on',...
'Tag','bs_pushbutton15');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton16'')', ...
'Position',[235.5 320 37.5 28.5], ...
'String','B6',...
'Visible','on',...
'Tag','bs_pushbutton16');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton17'')', ...
'Position',[280.5 320 37.5 28.5], ...
'String','B7',...
'Visible','on',...
'Tag','bs_pushbutton17');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton18'')', ...
'Position',[325.5 320 37.5 28.5], ...
'String','B8',...
'Visible','on',...
'Tag','bs_pushbutton18');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton19'')', ...
'Position',[370.5 320 37.5 28.5], ...
'String','B9',...
'Visible','on',...
'Tag','bs_pushbutton19');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton20'')', ...
'Position',[415.5 320 37.5 28.5], ...
'String','B10',...
'Visible','on',...
'Tag','bs_pushbutton20');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton21'')', ...
'Position',[10.5 285 37.5 28.5], ...
'String','C1',...
'Visible','on',...
'Tag','bs_pushbutton21');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton22'')', ...
'Position',[55.5 285 37.5 28.5], ...
'String','C2', ...
'Visible','on',...
'Tag','bs_pushbutton22');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton23'')', ...
'Position',[100.5 285 37.5 28.5], ...
'String','C3', ...
'Visible','on',...
'Tag','bs_pushbutton23');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton24'')', ...
'Position',[145.5 285 37.5 28.5], ...
'String','C4', ...
'Visible','on',...
'Tag','bs_pushbutton24');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton25'')', ...
'Position',[190.5 285 37.5 28.5], ...
'String','C5',...
'Visible','on',...
'Tag','bs_pushbutton25');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton26'')', ...
'Position',[235.5 285 37.5 28.5], ...
'String','C6',...
'Visible','on',...
'Tag','bs_pushbutton26');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton27'')', ...
'Position',[280.5 285 37.5 28.5], ...
'String','C7',...
'Visible','on',...
'Tag','bs_pushbutton27');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton28'')', ...
'Position',[325.5 285 37.5 28.5], ...
'String','C8',...
'Visible','on',...
'Tag','bs_pushbutton28');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton29'')', ...
'Position',[370.5 285 37.5 28.5], ...
'String','C9',...
'Visible','on',...
'Tag','bs_pushbutton29');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton30'')', ...
'Position',[415.5 285 37.5 28.5], ...
'String','C10',...
'Visible','on',...
'Tag','bs_pushbutton30');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton31'')', ...
'Position',[10.5 250 37.5 28.5], ...
'String','D1',...
'Visible','on',...
'Tag','bs_pushbutton31');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton32'')', ...
'Position',[55.5 250 37.5 28.5], ...
'String','D2', ...
'Visible','on',...
'Tag','bs_pushbutton32');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton33'')', ...
'Position',[100.5 250 37.5 28.5], ...
'String','D3', ...
'Visible','on',...
'Tag','bs_pushbutton33');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton34'')', ...
'Position',[145.5 250 37.5 28.5], ...
'String','D4', ...
'Visible','on',...
'Tag','bs_pushbutton34');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton35'')', ...
'Position',[190.5 250 37.5 28.5], ...
'String','D5',...
'Visible','on',...
'Tag','bs_pushbutton35');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton36'')', ...
'Position',[235.5 250 37.5 28.5], ...
'String','D6',...
'Visible','on',...
'Tag','bs_pushbutton36');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton37'')', ...
'Position',[280.5 250 37.5 28.5], ...
'String','D7',...
'Visible','on',...
'Tag','bs_pushbutton37');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton38'')', ...
'Position',[325.5 250 37.5 28.5], ...
'String','D8',...
'Visible','on',...
'Tag','bs_pushbutton38');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton39'')', ...
'Position',[370.5 250 37.5 28.5], ...
'String','D9',...
'Visible','on',...
'Tag','bs_pushbutton39');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton40'')', ...
'Position',[415.5 250 37.5 28.5], ...
'String','D10',...
'Visible','on',...
'Tag','bs_pushbutton40');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton41'')', ...
'Position',[10.5 215 37.5 28.5], ...
'String','E1',...
'Visible','on',...
'Tag','bs_pushbutton41');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton42'')', ...
'Position',[55.5 215 37.5 28.5], ...
'String','E2',...
'Visible','on',...
'Tag','bs_pushbutton42');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton43'')', ...
'Position',[100.5 215 37.5 28.5], ...
'String','E3',...
'Visible','on',...
'Tag','bs_pushbutton43');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton44'')', ...
'Position',[145.5 215 37.5 28.5], ...
'String','E4',...
'Visible','on',...
'Tag','bs_pushbutton44');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton45'')', ...
'Position',[190.5 215 37.5 28.5], ...
'String','E5',...
'Visible','on',...
'Tag','bs_pushbutton45');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton46'')', ...
'Position',[235.5 215 37.5 28.5], ...
'String','E6',...
'Visible','on',...
'Tag','bs_pushbutton46');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton47'')', ...
'Position',[280.5 215 37.5 28.5], ...
'String','E7',...
'Visible','on',...
'Tag','bs_pushbutton47');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton48'')', ...
'Position',[325.5 215 37.5 28.5], ...
'String','E8',...
'Visible','on',...
'Tag','bs_pushbutton48');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton49'')', ...
'Position',[370.5 215 37.5 28.5], ...
'String','E9',...
'Visible','on',...
'Tag','bs_pushbutton49');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton50'')', ...
'Position',[415.5 215 37.5 28.5], ...
'String','E10',...
'Visible','on',...
'Tag','bs_pushbutton50');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Position',[10.5 180 37.5 28.5], ...
'String','F1',...
'Tag','bs_pushbutton51',...
'Visible','on',...
'Callback','battleship(''pushbutton51'')');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Position',[55.5 180 37.5 28.5], ...
'String','F2',...
'Tag','bs_pushbutton52',...
'Visible','on',...
'Callback','battleship(''pushbutton52'')');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Position',[100.5 180 37.5 28.5], ...
'Callback','battleship(''pushbutton53'')', ...
'String','F3', ...
'Visible','on',...
'Tag','bs_pushbutton53');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton54'')', ...
'Position',[145.5 180 37.5 28.5], ...
'String','F4', ...
'Visible','on',...
'Tag','bs_pushbutton54');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton55'')', ...
'Position',[190.5 180 37.5 28.5], ...
'String','F5',...
'Visible','on',...
'Tag','bs_pushbutton55');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton56'')', ...
'Position',[235.5 180 37.5 28.5], ...
'String','F6',...
'Visible','on',...
'Tag','bs_pushbutton56');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton57'')', ...
'Position',[280.5 180 37.5 28.5], ...
'String','F7',...
'Visible','on',...
'Tag','bs_pushbutton57');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton58'')', ...
'Position',[325.5 180 37.5 28.5], ...
'String','F8',...
'Visible','on',...
'Tag','bs_pushbutton58');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton59'')', ...
'Position',[370.5 180 37.5 28.5], ...
'String','F9',...
'Visible','on',...
'Tag','bs_pushbutton59');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton60'')', ...
'Position',[415.5 180 37.5 28.5], ...
'String','F10',...
'Visible','on',...
'Tag','bs_pushbutton60');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton61'')', ...
'Position',[10.5 145 37.5 28.5], ...
'String','G1',...
'Visible','on',...
'Tag','bs_pushbutton61');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton62'')', ...
'Position',[55.5 145 37.5 28.5], ...
'String','G2',...
'Visible','on',...
'Tag','bs_pushbutton62');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton63'')', ...
'Position',[100.5 145 37.5 28.5], ...
'String','G3', ...
'Visible','on',...
'Tag','bs_pushbutton63');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton64'')', ...
'Position',[145.5 145 37.5 28.5], ...
'String','G4', ...
'Visible','on',...
'Tag','bs_pushbutton64');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton65'')', ...
'Position',[190.5 145 37.5 28.5], ...
'String','G5',...
'Visible','on',...
'Tag','bs_pushbutton65');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton66'')', ...
'Position',[235.5 145 37.5 28.5], ...
'String','G6',...
'Visible','on',...
'Tag','bs_pushbutton66');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton67'')', ...
'Position',[280.5 145 37.5 28.5], ...
'String','G7',...
'Visible','on',...
'Tag','bs_pushbutton67');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton68'')', ...
'Position',[325.5 145 37.5 28.5], ...
'String','G8',...
'Visible','on',...
'Tag','bs_pushbutton68');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton69'')', ...
'Position',[370.5 145 37.5 28.5], ...
'String','G9',...
'Visible','on',...
'Tag','bs_pushbutton69');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton70'')', ...
'Position',[415.5 145 37.5 28.5], ...
'String','G10',...
'Visible','on',...
'Tag','bs_pushbutton70');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton71'')', ...
'Position',[10.5 110 37.5 28.5], ...
'String','H1',...
'Visible','on',...
'Tag','bs_pushbutton71');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton72'')', ...
'Position',[55.5 110 37.5 28.5], ...
'String','H2', ...
'Visible','on',...
'Tag','bs_pushbutton72');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton73'')', ...
'Position',[100.5 110 37.5 28.5], ...
'String','H3', ...
'Visible','on',...
'Tag','bs_pushbutton73');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton74'')', ...
'Position',[145.5 110 37.5 28.5], ...
'String','H4', ...
'Visible','on',...
'Tag','bs_pushbutton74');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton75'')', ...
'Position',[190.5 110 37.5 28.5], ...
'String','H5',...
'Visible','on',...
'Tag','bs_pushbutton75');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton76'')', ...
'Position',[235.5 110 37.5 28.5], ...
'String','H6',...
'Visible','on',...
'Tag','bs_pushbutton76');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton77'')', ...
'Position',[280.5 110 37.5 28.5], ...
'String','H7',...
'Visible','on',...
'Tag','bs_pushbutton77');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton78'')', ...
'Position',[325.5 110 37.5 28.5], ...
'String','H8',...
'Visible','on',...
'Tag','bs_pushbutton78');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton79'')', ...
'Position',[370.5 110 37.5 28.5], ...
'String','H9',...
'Visible','on',...
'Tag','bs_pushbutton79');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton80'')', ...
'Position',[415.5 110 37.5 28.5], ...
'String','H10',...
'Visible','on',...
'Tag','bs_pushbutton80');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton81'')', ...
'Position',[10.5 75 37.5 28.5], ...
'String','I1',...
'Visible','on',...
'Tag','bs_pushbutton81');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton82'')', ...
'Position',[55.5 75 37.5 28.5], ...
'String','I2', ...
'Visible','on',...
'Tag','bs_pushbutton82');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton83'')', ...
'Position',[100.5 75 37.5 28.5], ...
'String','I3', ...
'Visible','on',...
'Tag','bs_pushbutton83');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton84'')', ...
'Position',[145.5 75 37.5 28.5], ...
'String','I4', ...
'Visible','on',...
'Tag','bs_pushbutton84');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton85'')', ...
'Position',[190.5 75 37.5 28.5], ...
'String','I5',...
'Visible','on',...
'Tag','bs_pushbutton85');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton86'')', ...
'Position',[235.5 75 37.5 28.5], ...
'String','I6',...
'Visible','on',...
'Tag','bs_pushbutton86');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton87'')', ...
'Position',[280.5 75 37.5 28.5], ...
'String','I7',...
'Visible','on',...
'Tag','bs_pushbutton87');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton88'')', ...
'Position',[325.5 75 37.5 28.5], ...
'String','I8',...
'Visible','on',...
'Tag','bs_pushbutton88');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton89'')', ...
'Position',[370.5 75 37.5 28.5], ...
'String','I9',...
'Visible','on',...
'Tag','bs_pushbutton89');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton90'')', ...
'Position',[415.5 75 37.5 28.5], ...
'String','I10',...
'Visible','on',...
'Tag','bs_pushbutton90');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton91'')', ...
'Position',[10.5 40 37.5 28.5], ...
'String','J1',...
'Visible','on',...
'Tag','bs_pushbutton91');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton92'')', ...
'Position',[55.5 40 37.5 28.5], ...
'String','J2',...
'Visible','on',...
'Tag','bs_pushbutton92');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton93'')', ...
'Position',[100.5 40 37.5 28.5], ...
'String','J3',...
'Visible','on',...
'Tag','bs_pushbutton93');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton94'')', ...
'Position',[145.5 40 37.5 28.5], ...
'String','J4',...
'Visible','on',...
'Tag','bs_pushbutton94');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton95'')', ...
'Position',[190.5 40 37.5 28.5], ...
'String','J5',...
'Visible','on',...
'Tag','bs_pushbutton95');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton96'')', ...
'Position',[235.5 40 37.5 28.5], ...
'String','J6',...
'Visible','on',...
'Tag','bs_pushbutton96');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton97'')', ...
'Position',[280.5 40 37.5 28.5], ...
'String','J7',...
'Visible','on',...
'Tag','bs_pushbutton97');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton98'')', ...
'Position',[325.5 40 37.5 28.5], ...
'String','J8',...
'Visible','on',...
'Tag','bs_pushbutton98');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton99'')', ...
'Position',[370.5 40 37.5 28.5], ...
'String','J9',...
'Visible','on',...
'Tag','bs_pushbutton99');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'ListboxTop',0, ...
'Callback','battleship(''pushbutton100'')', ...
'Position',[415.5 40 37.5 28.5], ...
'String','J10',...
'Visible','on',...
'Tag','bs_pushbutton100');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0 0 0], ...
'ListboxTop',0, ...
'Position',[10.5 10 443 23], ...
'FontName','Arial', ...
'FontSize',20, ...
'FontWeight','bold',...
'ForegroundColor',[1 0 0], ...
'String','1 2 3 4 5 6 7 8 9 10',...
'Style','text',...
'Tag','bs_text_title');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0 0 0], ...
'ListboxTop',0, ...
'Position',[460 355 22 28.5], ...
'FontName','Arial', ...
'FontSize',20, ...
'FontWeight','bold',...
'ForegroundColor',[1 0 0], ...
'String','A',...
'Style','text',...
'Tag','bs_a');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0 0 0], ...
'ListboxTop',0, ...
'Position',[460 320 22 28.5], ...
'FontName','Arial', ...
'FontSize',20, ...
'FontWeight','bold',...
'ForegroundColor',[1 0 0], ...
'String','B',...
'Style','text',...
'Tag','bs_b');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0 0 0], ...
'ListboxTop',0, ...
'Position',[460 285 22 28.5], ...
'FontName','Arial', ...
'FontSize',20, ...
'FontWeight','bold',...
'ForegroundColor',[1 0 0], ...
'String','C',...
'Style','text',...
'Tag','bs_c');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0 0 0], ...
'ListboxTop',0, ...
'Position',[460 250 22 28.5], ...
'FontName','Arial', ...
'FontSize',20, ...
'FontWeight','bold',...
'ForegroundColor',[1 0 0], ...
'String','D',...
'Style','text',...
'Tag','bs_d');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0 0 0], ...
'ListboxTop',0, ...
'Position',[460 215 22 28.5], ...
'FontName','Arial', ...
'FontSize',20, ...
'FontWeight','bold',...
'ForegroundColor',[1 0 0], ...
'String','E',...
'Style','text',...
'Tag','bs_s');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0 0 0], ...
'ListboxTop',0, ...
'Position',[460 180 22 28.5], ...
'FontName','Arial', ...
'FontSize',20, ...
'FontWeight','bold',...
'ForegroundColor',[1 0 0], ...
'String','F',...
'Style','text',...
'Tag','bs_f');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0 0 0], ...
'ListboxTop',0, ...
'Position',[460 145 22 28.5], ...
'FontName','Arial', ...
'FontSize',20, ...
'FontWeight','bold',...
'ForegroundColor',[1 0 0], ...
'String','G',...
'Style','text',...
'Tag','bs_g');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0 0 0], ...
'ListboxTop',0, ...
'Position',[460 110 22 28.5], ...
'FontName','Arial', ...
'FontSize',20, ...
'FontWeight','bold',...
'ForegroundColor',[1 0 0], ...
'String','H',...
'Style','text',...
'Tag','bs_h');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0 0 0], ...
'ListboxTop',0, ...
'Position',[460 75 22 28.5], ...
'FontName','Arial', ...
'FontSize',20, ...
'FontWeight','bold',...
'ForegroundColor',[1 0 0], ...
'String','I',...
'Style','text',...
'Tag','bs_i');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0 0 0], ...
'ListboxTop',0, ...
'Position',[460 40 22 28.5], ...
'FontName','Arial', ...
'FontSize',20, ...
'FontWeight','bold',...
'ForegroundColor',[1 0 0], ...
'String','J',...
'Style','text',...
'Tag','bs_j');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0 0 0], ...
'ListboxTop',0, ...
'Position',[460 348.5 22 6.5], ...
'Style','text',...
'Tag','bs_x');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0 0 0], ...
'ListboxTop',0, ...
'Position',[460 313.5 22 6.5], ...
'Style','text',...
'Tag','bs_x');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0 0 0], ...
'ListboxTop',0, ...
'Position',[460 278.5 22 6.5], ...
'Style','text',...
'Tag','bs_x');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0 0 0], ...
'ListboxTop',0, ...
'Position',[460 243.5 22 6.5], ...
'Style','text',...
'Tag','bs_x');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0 0 0], ...
'ListboxTop',0, ...
'Position',[460 208.5 22 6.5], ...
'Style','text',...
'Tag','bs_x');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0 0 0], ...
'ListboxTop',0, ...
'Position',[460 173.5 22 6.5], ...
'Style','text',...
'Tag','bs_x');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0 0 0], ...
'ListboxTop',0, ...
'Position',[460 138.5 22 6.5], ...
'Style','text',...
'Tag','bs_x');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0 0 0], ...
'ListboxTop',0, ...
'Position',[460 103.5 22 6.5], ...
'Style','text',...
'Tag','bs_x');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0 0 0], ...
'ListboxTop',0, ...
'Position',[460 68.5 22 6.5], ...
'Style','text',...
'Tag','bs_x');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0 0 0], ...
'ListboxTop',0, ...
'Position',[460 10 22 30], ...
'Style','text',...
'Tag','bs_x');
h1 = uicontrol('Parent',h0, ...
'Units','points', ...
'BackgroundColor',[0 0 0], ...
'ListboxTop',0, ...
'Position',[450 10 22 23], ...
'Style','text',...
'Tag','bs_x');
if nargout > 0, fig = h0; end
%###########################################################################################################################