JavaScript implementation of Game of 15