Langdon's Ant in JavaScript