The main ant.cpp function has been rewritten with subfunctions