antfoodahead.m
来自「The Source of Genetic Programming develo」· M 代码 · 共 24 行
M
24 行
function food=antfoodahead
%ANTFOODAHEAD Tests if there is food ahead of the GPLAB artificial ant.
% ANTFOODAHEAD returns true if there is food ahead of the artificial ant;
% returns false otherwise.
%
% Output arguments:
% FOOD - whether there is food ahead (boolean)
%
% See also ANTFITNESS, ANTMOVE, ANTIF, ANTRIGHT, ANTLEFT, ANTPROGN2, ANTPROGN3
%
% Copyright (C) 2003-2007 Sara Silva (sara@dei.uc.pt)
% This file is part of the GPLAB Toolbox
global trail;
global x;
global y;
global direction;
%global npellets;
%global maxtime;
%global ntime;
[newx,newy]=antnewpos(x,y,direction,trail);
food=(trail(newx,newy)==1);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?