the function that i want to write a test script for is:
-----------------------------
%This function moves the shark one square at a time toward a given goldfish
%and terminates when the shark is vertically or horizontally adjacent to
%the said goldfish.
function newShark=moveToGoldfish(board,goldfishCoords,shark)
while isAdjacent(goldfishCoords,shark)~=true
[canMove newShark]=moveOneSquare(board,goldfishCoords,shark);
if canMove==true
board(shark(1),shark(2))='-';
print(board,newShark);
shark=newShark;
else
disp('Cannot Move');
end
end
newShark=shark;
------------------------------------
-----------------------------
%This function moves the shark one square at a time toward a given goldfish
%and terminates when the shark is vertically or horizontally adjacent to
%the said goldfish.
function newShark=moveToGoldfish(board,goldfishCoords,shark)
while isAdjacent(goldfishCoords,shark)~=true
[canMove newShark]=moveOneSquare(board,goldfishCoords,shark);
if canMove==true
board(shark(1),shark(2))='-';
print(board,newShark);
shark=newShark;
else
disp('Cannot Move');
end
end
newShark=shark;
------------------------------------