Research Article

Emergence of a Snake-Like Structure in Mobile Distributed Agents: An Exploratory Agent-Based Modeling Approach

Algorithm 2

Main animation algorithm.
Data: Agent Set comprising of all agents
Result: Perform single simulation time step
for All Agents do
if  leader? = true  then
  Move Random;
else
  if  parent?! = 0  then
   face parent;
   Turn Right ;
   Forward ;
   Right ;
   Let is Distance to Parent;
   Forward ;
  else
   Move Random;
   if  Leader Node in radius  then
    Make Leader Node Parent;
   end
  end
end
end