Code covered by the BSD License
-
atboard
Author: Isaac Noh
-
atgridpt(position,row,col)
Author: Isaac Noh
-
locboard
Author: Isaac Noh
-
battleship
Author: Isaac Noh
-
bsclose
Author: Isaac Noh
-
bsconnect(hObject,eventdata,l...
Author: Isaac Noh
-
gameOver(u2)
Author: Isaac Noh
-
genLocation(h)
Author: Isaac Noh
-
locgridpt(ax)
Author: Isaac Noh
-
readPort(u2,DatagramReceived,...
Author: Isaac Noh
-
ship(pos,type,orientation,ax)
Author: Isaac Noh
-
soundOff(hObject,eventdata)
Author: Isaac Noh
-
speak(varargin)
SPEAK using Excel(R) to speak entered texts or numbers
-
sunk(varargin)
Author: Isaac Noh
-
View all files
from
BattleShip (R)
by Isaac Noh
Learn and have fun with an old classic.
|
| atgridpt(position,row,col)
|
function obj = atgridpt(position,row,col)
% Author: Isaac Noh
% Copyright 2008-2009 The MathWorks, Inc.
% Version: 1.1
if nargin == 0
obj.handle = 0;
else
% "Constructor" for psuedo object ATGRIDPT
obj.handle = uicontrol('Style','radiobutton',...
'Units','normalized',...
'Position',position,...
'BackgroundColor', [0 0 0.7],...
'UserData',[row col]);
end
% Methods for ATGRIDPT
obj.sethit = @sethit;
obj.gethit = @gethit;
obj.settarget = @settarget;
obj.gettarget = @gettarget;
obj.setlocation = @setlocation;
obj.getlocation = @getlocation;
% Properties for ATGRIDPT
hit = false;
target = false;
location = '';
% Definition of methods
function obj = sethit(val)
% val should be of datatype logical
hit = val;
end
function out = gethit
% val should be of datatype logical
out = hit;
end
function obj = settarget(val)
% val should be of datatype logical
target = val;
end
function out = gettarget
% val should be of datatype logical
out = target;
end
function obj = setlocation(val)
% val should be of datatype char
location = val;
end
function out = getlocation
% val should be of datatype char
out = location;
end
end
|
|
Contact us at files@mathworks.com