making the ant problem more similar to the one in the book
some performance improvements