JS implementation of Coordinates game