Ants

Visually enhanced from Daniel Shiffman’s Nature of Code example.

Instructions

Left and drag to draw the path which ants can follow. ( path is highlight in debug mode[hit space] )

Right click to add new ant with random max speed and force.

Hit A key to change the bug.

Hit space for debug mode.

 

Source code: gitlab

 

parameters

some parameter explaination

AntFollowing.pde > SMOOTH_DIST [to skip the points that are recorded while draging, two adjacent point will have atleast SMOOTH_DISTANCE between them in path]

Vehicle.pde> PLOC_FACTOR are the frame use to lookahead to accelerate towards that location on the path if ant is away from path.

 

FacebookTwitterGoogle+Share