Javscript logic game