Simple game of SNAP with JavaScript