Famous game' js implementation