📄 getcolor.m
字号:
function color = getColor(from)
% findPos Determines the color of a certain field
% The color (black or white) of the figure from a certain field is
% determined.
%
% Inputs:
% * from ... field in matrix notation, from which to obtain the color
% * board ... chess board and related information
%
% Outputs:
% * color ... figure color of a certain chess field (0..black,1...white)
%
% Example
% Assume there is a white knight on f3 [6 6], then |getColor([6 6])|
% returns one for the white color.
%
% See also: Chess, stopCursor
%
%% Signature
% Author: W.Garn
% E-Mail: wgarn@yahoo.com
% Date: 2006/03/23 12:00:00
%
% Copyright 2006 W.Garn
%
global board;
f = board.figures(from(1),from(2));
if double(f)<double('a'), color=1; else color=0; end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -