solver - % OUTPUTS: (all scalars) % dy -- delta in rows (-1...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function [dy,dx,mark,carry] = solver(nain,food,ants,scent) %SOLVER The ant brain. % % INPUTS: (all 5x5 matrices, the ant is located at the center) % main -- anthills (1), impassable regions (-1), and open space (0) % food -- number of sugar cubes % ant -- number of ants (always be at least 1 at (3,3)) % scent -- strength of chemical scent (decreases by one each time interval) %
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % OUTPUTS: (all scalars) % dy -- delta in rows (-1 is up, 0 no move, 1 is down) % dx -- delta in columns (-1 is left, 0 no move, 1 is right) % mark -- scent left by the ant, any integer between 0 and 100 % carry -- logical indicating if the ant will carry one unit of food or not % % Copyright 2005 The MathWorks, Inc. % dy = 0; dx = 0; mark = 0; carry = logical(0);...
View Full Document

Ask a homework question - tutors are online