from
Chess with "Greedy Edi"
by Wolfgang Garn
Play chess against "Greedy Edi".
|
| resurrect_figure (figName, pos)
|
function resurrect_figure (figName, pos)
% resurrect_figure removes(beats) a figure from the field and deletes the instance
%
% Inputs:
% * figName ... name of figure (e.g. 'r' or 'n')
% * pos ... position in matrix notation (i.e. [2 3])
% * global board ... chess board information
% * global game ... information about the game status
%
% Outputs:
% * global game ... possible change in game status (i.e. King is beaten)
% * global board ... remove a certain figure from the board (if there was any)
%
% Note: If name of figure is ' ' then no resurrection takes place.
%
% Example
%
% See also: remove_figure
%
% TODO
% * get proper instance name
%
%% Signature
% Author: W.Garn
% E-Mail: wgarn@yahoo.com
% Date: 2010/04/18 12:00:00
%
% Copyright 2010 W.Garn
%
if figName~=' '
global board;
global game;
instance = 'resurrected'; % normally this should be unique
if figName<'a' % then white figure (because its a capital letter
colour=1;
else
colour=0;
end
[name, handle_chess_figure] = getFigureName(figName);
handle_chess_figure('init',pos, colour, instance); %1: pos, 2: color, 3: instance
end
|
|
Contact us at files@mathworks.com