Untangle game using javscript