• Welcome to the Speedsolving.com, home of the web's largest puzzle community!
    You are currently viewing our forum as a guest which gives you limited access to join discussions and access our other features.

    Registration is fast, simple and absolutely free so please, join our community of 40,000+ people from around the world today!

    If you are already a member, simply login to hide this message and begin participating in the community!

WCA official scrambler broken?

Eleredo

Member
Joined
Jun 20, 2010
Messages
227
Location
Belgium
I was scrambling my 7x7x7 using the WCA scrambler (so I can see whether I scrambled it correctly). I saw something funny:

magil3.jpg


Anyone else noticed this too?
 

qqwref

Member
Joined
Dec 18, 2007
Messages
7,834
Location
a <script> tag near you
WCA
2006GOTT01
YouTube
Visit Channel
I think I found the problem - it's in the scramblestring function.

Code:
if( k && size<=5 && !mult ) {
	s+="dlburf".charAt(j);
}else{
	if(size<=5 && mult ){
		s+="DLBURF".charAt(j);
		if(k) s+="w";
	}else{
		if(k)	s+=(k+1);
		s+="DLBURF".charAt(j);
	}
}

So, normally, k is an integer specifying the "depth" of this turn, and this works perfectly. Now I'm not really sure why, but sometimes if(k) turns out false, even though if(k>0) turns out true. This shouldn't be happening, but for some reason, it is. I replaced all the if(k) with if(k>0) and the problem went away:

Code:
if( k>0 && size<=5 && !mult ) {
	s+="dlburf".charAt(j);
}else{
	if(size<=5 && mult ){
		s+="DLBURF".charAt(j);
		if(k>0) s+="w";
	}else{
		if(k>0)	s+=(k+1);
		s+="DLBURF".charAt(j);
	}
}

My guess as to the cause: a more recent version of javascript (or an internet browser?) created some kind of way where, even though k is a positive integer, if(k) might be false but if(k>0) might be true. The problem with the scrambler didn't happen before because this wasn't an issue before.
 

Mike Hughey

Administrator
Staff member
Joined
Jun 7, 2007
Messages
11,305
Location
Indianapolis
WCA
2007HUGH01
SS Competition Results
YouTube
Visit Channel
My guess as to the cause: a more recent version of javascript (or an internet browser?) created some kind of way where, even though k is a positive integer, if(k) might be false but if(k>0) might be true. The problem with the scrambler didn't happen before because this wasn't an issue before.

Great detective work!
 

Stefan

Member
Joined
May 7, 2006
Messages
7,280
WCA
2003POCH01
YouTube
Visit Channel
Tim Reynolds noticed that a few weeks ago as well and I traced it back to the same point in the code. I'm no javascript expert, but in my view, it's clearly a bug in Firefox's javascript engine (several of us were able to get failures in Firefox but not in other browsers, and the thread starter here used Firefox as well). A value of 1 or 2 should definitely be considered true. I tried to recreate the problem with a short program to submit a bug report, but I couldn't (and then I left to America).
 
Last edited:
Top