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.
|
| locgridpt(ax)
|
function obj = locgridpt(ax)
% Author: Isaac Noh
% Copyright 2008-2009 The MathWorks, Inc.
% Version: 1.1
% "Constructor" for psuedo object LOCGRIDPT
obj.axhandle = ax;
% Methods for LOCGRIDPT
obj.sethit = @sethit;
obj.gethit = @gethit;
obj.setlocation = @setlocation;
obj.getlocation = @getlocation;
% Properties for LOCGRIDPT
location = '';
hit = '';
% Definition of methods
function sethit(val)
hit = val;
loc = location;
row = (11 - (double(loc(1)) - 64))/10;
col = str2double(loc(2:end))/10;
ax = obj.axhandle;
if val == true
H = zeros(2,2,3);
H(:,:,1) = 1;
else
H = ones(2,2,3);
end
surface(zeros(2),H,...
'XData',[(col - 0.1) col],...
'YData',[(row - 0.1) row],...
'Parent',ax);
end
function out = gethit
out = hit;
end
function setlocation(val)
location = val;
end
function out = getlocation
out = location;
end
end
|
|
Contact us at files@mathworks.com