⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getfigurename.m

📁 国际象棋程序,解压到当前目录,在matlab窗口输入chess即可应用
💻 M
字号:
function [name, handle_chess_figure] = getFigureName(fig)
% getFigureName returns the figures name and the handle to the figure class
% The figures name and its handle is returned.
%
% Inputs:
% * fig ... single character describing the figure (i.e. k,q,r,b,...)
%
% Outputs:
% * name ... the whole name of the figure (i.e. King, Queen, Rook,...)
% * handle_chess_figure ... handle to the chess figure class(function)
%
% Example
% The command |[name, handle_chess_figure] = getFigureName('K')| returns
% the figures name |King| and the handle to its class |@King|.
%
% See also: King, Chess
%
%% Signature
% Author: W.Garn
% E-Mail: wgarn@yahoo.com
% Date: 2006/03/23 12:00:00 
% 
% Copyright 2006 W.Garn
%

f = lower(fig);
switch f
    case 'p'
        name = 'Pawn';
        handle_chess_figure = @Pawn;
    case 'n'
        name = 'Knight';
        handle_chess_figure = @Knight;
    case 'b'
        name = 'Bishop';
        handle_chess_figure = @Bishop;        
    case 'r'
        name = 'Rook';
        handle_chess_figure = @Rook;        
    case 'q'
        name = 'Queen';
        handle_chess_figure = @Queen;        
    case 'k'
        name = 'King';        
        handle_chess_figure = @King;        
    otherwise 
        name = []; 
        handle_chess_figure = [];        
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -