# how to download scrambles automatically



## rwcinoto (Jun 5, 2009)

Hi all!

We run a weekly contest in our brazilian cube forum (http://cubomagicobrasil.com) like the one in speedsolving, and we would like to download the scrambles automaticaly from the official scramblers, like http://www.worldcubeassociation.org/regulations/scrambles/scramble_cube_222.html.

I tried to do this simply with Excel access to web, but it didn´t work. Then I tried with Wget (http://www.gnu.org/software/wget/) and it didn´t work either. Finally I tried doing a little program in C using Lynx (http://lynx.isc.org/), but it didn´t work again.

I guess the problem is that the scrambles are generated from a script and these things I tried don´t get the script results.

Does anyone have a solution to this? I would like to write something in VBA in Excel, but in C it would be nice as well.

Thanks in advance!


----------



## qqwref (Jun 5, 2009)

I don't know of any way to automatically do it, but you could always just copy and paste the scrambles into the topic. That's what I would do.


----------



## masterofthebass (Jun 5, 2009)

Or, you could always generate your own.


----------



## rwcinoto (Jun 6, 2009)

qqwref said:


> I don't know of any way to automatically do it, but you could always just copy and paste the scrambles into the topic. That's what I would do.


That's what I didn't want to do, but if there's no other way...


----------



## rwcinoto (Jun 6, 2009)

masterofthebass said:


> Or, you could always generate your own.


Hummm... where can I get the codes for programming a scrambler for every puzzle?
2x2, 3x3, 4x4, 5x5, 6x6, 7x7, Megaminx, Square-1, Pyraminx.


----------



## byu (Jun 6, 2009)

HTML code for nxnxn sized cubes


```
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title>WCA Official Cube scrambler</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<script language="JavaScript1.1" type="text/javascript">
<!--
/* Javascript written by Jaap Scherphuis,  jaapsch a t yahoo d o t com */

// Default settings
var size=3;
var seqlen=30;
var numcub=5;
var mult=false;
var cubeorient=false;
var colorString = "yobwrg";  //In dlburf order. May use any colours in colorList below

// list of available colours
var colorList=new Array(
	'y', "yellow", "yellow",
	'b', "blue",   "blue",
	'r', "red",    "red",
	'w', "white",  "white",
	'g', "green",  "green",
	'o', "#ffA040","orange",   // 'orange' is not an official html colour name
	'p', "purple", "purple",
	'0', "gray",   "grey"      // used for unrecognised letters, or when zero used.
);

var colors=new Array(); //stores colours used
var seq=new Array();	// move sequences
var posit = new Array();	// facelet array
var flat2posit;	//lookup table for drawing cube
var colorPerm = new Array(); //dlburf face colour permutation for each cube orientation
colorPerm[ 0] = new Array(0,1,2,3,4,5);
colorPerm[ 1] = new Array(0,2,4,3,5,1);
colorPerm[ 2] = new Array(0,4,5,3,1,2);
colorPerm[ 3] = new Array(0,5,1,3,2,4);
colorPerm[ 4] = new Array(1,0,5,4,3,2);
colorPerm[ 5] = new Array(1,2,0,4,5,3);
colorPerm[ 6] = new Array(1,3,2,4,0,5);
colorPerm[ 7] = new Array(1,5,3,4,2,0);
colorPerm[ 8] = new Array(2,0,1,5,3,4);
colorPerm[ 9] = new Array(2,1,3,5,4,0);
colorPerm[10] = new Array(2,3,4,5,0,1);
colorPerm[11] = new Array(2,4,0,5,1,3);
colorPerm[12] = new Array(3,1,5,0,4,2);
colorPerm[13] = new Array(3,2,1,0,5,4);
colorPerm[14] = new Array(3,4,2,0,1,5);
colorPerm[15] = new Array(3,5,4,0,2,1);
colorPerm[16] = new Array(4,0,2,1,3,5);
colorPerm[17] = new Array(4,2,3,1,5,0);
colorPerm[18] = new Array(4,3,5,1,0,2);
colorPerm[19] = new Array(4,5,0,1,2,3);
colorPerm[20] = new Array(5,0,4,2,3,1);
colorPerm[21] = new Array(5,1,0,2,4,3);
colorPerm[22] = new Array(5,3,1,2,0,4);
colorPerm[23] = new Array(5,4,3,2,1,0);

// get all the form settings from the url parameters
function parse() {
	var s="";
	var urlquery=location.href.split("?")
	if(urlquery.length>1){
		var urlterms=urlquery[1].split("&")
		for( var i=0; i<urlterms.length; i++){
			var urllr=urlterms[i].split("=");
			if(urllr[0]=="size") {
				if(urllr[1]-0 >= 2 ) size=urllr[1]-0;
			} else if(urllr[0]=="len") {
				if(urllr[1]-0 >= 1 ) seqlen=urllr[1]-0;
			} else if(urllr[0]=="num"){
				if(urllr[1]-0 >= 1 ) numcub=urllr[1]-0;
			} else if(urllr[0]=="multi") {
				mult=(urllr[1]=="on");
			} else if(urllr[0]=="cubori") {
				cubeorient=(urllr[1]=="on");
			} else if(urllr[0]=="col") {
				if(urllr[1].length==6) colorString = urllr[1];
			}
		}
	}

	// expand colour string into 6 actual html color names
	for(var k=0; k<6; k++){
		colors[k]=colorList.length-3;	// gray
		for( var i=0; i<colorList.length; i+=3 ){
			if( colorString.charAt(k)==colorList[i] ){
				colors[k]=i;
				break;
			}
		}
	}
}

// append set of moves along an axis to current sequence in order
function appendmoves( sq, axsl, tl, la ){
	for( var sl=0; sl<tl; sl++){	// for each move type
		if( axsl[sl] ){				// if it occurs
			var q=axsl[sl]-1;

			// get semi-axis of this move
			var sa = la;
			var m = sl;
			if(sl+sl+1>=tl){ // if on rear half of this axis
				sa+=3; // get semi-axis (i.e. face of the move)
				m=tl-1-m; // slice number counting from that face
				q=2-q; // opposite direction when looking at that face
			}
			// store move
			sq[sq.length]=(m*6+sa)*4+q;
		}
	}
}

// generate sequence of scambles
function scramble(){
	//tl=number of allowed moves (twistable layers) on axis -- middle layer ignored
	var tl=size;
	if(mult || (size&1)!=0 ) tl--;
	//set up bookkeeping
	var axsl=new Array(tl);    // movement of each slice/movetype on this axis
	var axam=new Array(0,0,0); // number of slices moved each amount
	var la; // last axis moved

	// for each cube scramble
	for( n=0; n<numcub; n++){
		// initialise this scramble
		la=-1;
		seq[n]=new Array(); // moves generated so far
		// reset slice/direction counters
		for( var i=0; i<tl; i++) axsl[i]=0;
		axam[0]=axam[1]=axam[2]=0;
		var moved = 0;

		// while generated sequence not long enough
		while( seq[n].length + moved <seqlen ){

			var ax, sl, q;
			do{
				do{
					// choose a random axis
					ax=Math.floor(Math.random()*3);
					// choose a random move type on that axis
					sl=Math.floor(Math.random()*tl);
					// choose random amount
					q=Math.floor(Math.random()*3);
				}while( ax==la && axsl[sl]!=0 );		// loop until have found an unused movetype
			}while( ax==la					// loop while move is reducible: reductions only if on same axis as previous moves
					&& !mult				// multislice moves have no reductions so always ok
					&& tl==size				// only even-sized cubes have reductions (odds have middle layer as reference)
					&& (
						2*axam[0]==tl ||	// reduction if already have half the slices move in same direction
						2*axam[1]==tl ||
						2*axam[2]==tl ||
						(
							2*(axam[q]+1)==tl	// reduction if move makes exactly half the slices moved in same direction and
							&&
							axam[0]+axam[1]+axam[2]-axam[q] > 0 // some other slice also moved
						)
				    )
			);

			// if now on different axis, dump cached moves from old axis
			if( ax!=la ) {
				appendmoves( seq[n], axsl, tl, la );
				// reset slice/direction counters
				for( var i=0; i<tl; i++) axsl[i]=0;
				axam[0]=axam[1]=axam[2]=0;
				moved = 0;
				// remember new axis
				la=ax;
			}

			// adjust counters for this move
			axam[q]++;// adjust direction count
			moved++;
			axsl[sl]=q+1;// mark the slice has moved amount

		}
		// dump the last few moves
		appendmoves( seq[n], axsl, tl, la );

		// do a random cube orientation if necessary
		seq[n][seq[n].length]= cubeorient ? Math.floor(Math.random()*24) : 0;
	}

	// build lookup table
	flat2posit=new Array(12*size*size);
	for(i=0; i<flat2posit.length; i++) flat2posit[i]=-1;
	for(i=0; i<size; i++){
		for(j=0; j<size; j++){
			flat2posit[4*size*(3*size-i-1)+  size+j  ]=        i *size+j;	//D
			flat2posit[4*size*(  size+i  )+  size-j-1]=(  size+i)*size+j;	//L
			flat2posit[4*size*(  size+i  )+4*size-j-1]=(2*size+i)*size+j;	//B
			flat2posit[4*size*(       i  )+  size+j  ]=(3*size+i)*size+j;	//U
			flat2posit[4*size*(  size+i  )+2*size+j  ]=(4*size+i)*size+j;	//R
			flat2posit[4*size*(  size+i  )+  size+j  ]=(5*size+i)*size+j;	//F
		}
	}

/*
       19                32
   16           48           35
       31   60      51   44
   28     80    63    67     47
              83  64
          92          79
              95  76

                 0
             12     3
                15
*/
}

function scramblestring(n){
	var s="",j;
	for(var i=0; i<seq[n].length-1; i++){
		if( i!=0 ) s+=" ";
		var k=seq[n][i]>>2;

		j=k%6; k=(k-j)/6;
		if( k && size<=5 && !mult ) {
			s+="dlburf".charAt(j);	// use lower case only for inner slices on 4x4x4 or 5x5x5
		}else{
			if(size<=5 && mult ){
				s+="DLBURF".charAt(j);
				if(k) s+="w";	// use w only for double layers on 4x4x4 and 5x5x5
			}
			else{
				if(k)	s+=(k+1);
				s+="DLBURF".charAt(j);
			}
		}

		j=seq[n][i]&3;
		if(j!=0) s+=" 2'".charAt(j);
	}

	// add cube orientation
	if( cubeorient ){
		var ori = seq[n][seq[n].length-1];
		s="Top:"+colorList[ 2+colors[colorPerm[ori][3]] ]
			+"&nbsp;&nbsp;&nbsp;Front:"+colorList[2+ colors[colorPerm[ori][5]] ]+"<br>"+s;
	}
	return s;
}

function imagestring(nr){
	var s="",i,f,d=0,q;

	// initialise colours
	for( i=0; i<6; i++)
		for( f=0; f<size*size; f++)
			posit[d++]=i;

	// do move sequence
	for(i=0; i<seq[nr].length-1; i++){
		q=seq[nr][i]&3;
		f=seq[nr][i]>>2;
		d=0;
		while(f>5) { f-=6; d++; }
		do{
			doslice(f,d,q+1);
			d--;
		}while( mult && d>=0 );
	}

	// build string containing cube
	var ori = seq[nr][seq[nr].length-1];
	d=0;
	s="<table border=0 cellpadding=0 cellspacing=0>";
	for(i=0;i<3*size;i++){
		s+="<tr>";
		for(f=0;f<4*size;f++){
			if(flat2posit[d]<0){
				s+="<td><\/td>";
			}else{
				var c = colorPerm[ori][posit[flat2posit[d]]];
				s+="<td bgcolor="+colorList[colors[c]+1]+"><img src='images/blank.gif' width=10 border=1 height=10><\/td>";
			}
			d++;
		}
		s+="<\/tr>";
	}
	s+="<\/table>";
	return(s);
}

function doslice(f,d,q){
	//do move of face f, layer d, q quarter turns
	var f1,f2,f3,f4;
	var s2=size*size;
	var c,i,j,k;
	if(f>5)f-=6;
	// cycle the side facelets
	for(k=0; k<q; k++){
		for(i=0; i<size; i++){
			if(f==0){
				f1=6*s2-size*d-size+i;
				f2=2*s2-size*d-1-i;
				f3=3*s2-size*d-1-i;
				f4=5*s2-size*d-size+i;
			}else if(f==1){
				f1=3*s2+d+size*i;
				f2=3*s2+d-size*(i+1);
				f3=  s2+d-size*(i+1);
				f4=5*s2+d+size*i;
			}else if(f==2){
				f1=3*s2+d*size+i;
				f2=4*s2+size-1-d+size*i;
				f3=	 d*size+size-1-i;
				f4=2*s2-1-d-size*i;
			}else if(f==3){
				f1=4*s2+d*size+size-1-i;
				f2=2*s2+d*size+i;
				f3=  s2+d*size+i;
				f4=5*s2+d*size+size-1-i;
			}else if(f==4){
				f1=6*s2-1-d-size*i;
				f2=size-1-d+size*i;
				f3=2*s2+size-1-d+size*i;
				f4=4*s2-1-d-size*i;
			}else if(f==5){
				f1=4*s2-size-d*size+i;
				f2=2*s2-size+d-size*i;
				f3=s2-1-d*size-i;
				f4=4*s2+d+size*i;
			}
			c=posit[f1];
			posit[f1]=posit[f2];
			posit[f2]=posit[f3];
			posit[f3]=posit[f4];
			posit[f4]=c;
		}

		/* turn face */
		if(d==0){
			for(i=0; i+i<size; i++){
				for(j=0; j+j<size-1; j++){
					f1=f*s2+         i+         j*size;
					f3=f*s2+(size-1-i)+(size-1-j)*size;
					if(f<3){
						f2=f*s2+(size-1-j)+         i*size;
						f4=f*s2+         j+(size-1-i)*size;
					}else{
						f4=f*s2+(size-1-j)+         i*size;
						f2=f*s2+         j+(size-1-i)*size;
					}
					c=posit[f1];
					posit[f1]=posit[f2];
					posit[f2]=posit[f3];
					posit[f3]=posit[f4];
					posit[f4]=c;
				}
			}
		}
	}
}

function help(){
	alert("Cube Scrambler\n\n"+
		"This cube scrambler can scramble a cube of any size.\n"+
		"Enter the cube size, the number of scrambles you want,\n"+
		"and the length of each scramble (in htm). If you then\n"+
		"press the Scramble button the page will reload and show\n"+
		"the new scrambles. Every time you then reload the page\n"+
		"or click the button, a new set of scrambles is generated.\n"+

		"\nFurther options:\n"+
		"Colours: The colour scheme to use in the previews. It\n"+
		"consists of 6 letters, the first letter of the colours\n"+
		"to use on the faces in DLBURF order. Allowed colours are\n"+
		"yellow, blue, red, white, green, orange, purple.\n"+
		"Multi-slice: If clear, an inner slice move is just a\n"+
		"single slice. If checked, an inner slice move means a\n"+
		"turn of the inner slice and all slices lying further\n"+
		"outwards as a single unit.\n"+
		"Cube Orient: If chosen, a random cube orientation is\n"+
		"chosen for each scramble.\n"+

		"\nScrambles:\n"+
		"The scrambles will not contain any moves that cancel\n"+
		"each other, nor moves that simplify to a cube rotation.\n"+

		"\nNotation:\n"+
		"Standard FLUBRD notation is used for the 2x2x2 and\n"+
		"3x3x3 cubes. With 4x4x4 and 5x5x5 cubes this is extended\n"+
		"with lower case letters flubrd indicating a turn of an\n"+
		"inner slice only, or in multi-slice mode the face letter\n"+
		"is followed by a w to indicate a 'wide' move. For even\n"+
		"larger cubes, inner slices are denoted by \n"+
		"notation.\n"+
		"Tip: On a 2x2x2 cube normally all 6 faces can be turned,\n"+
		"but if Multi-Slice is on, only the RFU faces are used.\n"+

		"\nPrinting:\n"+
		"The cube layout might not print correctly on a colour\n"+
		"printer. Make sure that your browser is set up to print\n"+
		"background colours, which is an Internet Options/Advanced\n"+
		"setting in Internet Explorer, or a setting in the Print\n"+
		"dialog in Mozilla Firefox.\n"+

		"\nWritten by Jaap Scherphuis, Copyright 2004-2008.");
}

parse();
function setForm(){
	document.frm.size.value=size;
	document.frm.len.value=seqlen;
	document.frm.num.value=numcub;
	document.frm.multi.checked=mult;
	document.frm.cubori.checked=cubeorient;
	document.frm.col.value=colorString;

	document.frm.subbutton.focus();
}

//-->
</script>

</head>

<body bgcolor="white" onload="setForm();">

<script language="JavaScript1.1" type="text/javascript">
<!--
document.writeln("\
<form name=frm action=''>\
<table border=1 cellpadding=0 cellspacing=0 width='100%'><tr>\
<td colspan=3 bgcolor='#00c0c0'>\
<table width='100%' cellpadding=2 cellspacing=0><tr>\
<td><font face='Arial' size=3>Cube size:<\/font><input name=size size=2 maxlength=2><\/td>\
<td><font face='Arial' size=3>Number of scrambles:<\/font><input name=num size=2 maxlength=2><\/td>\
<td><font face='Arial' size=3>Scramble length:<\/font><input name=len size=2 maxlength=3><\/td>\
<td><font face='Arial' size=3>Colours (DLBURF):<\/font><input name=col size=6 maxlength=6><\/td>\
<td><font face='Arial' size=3>Multi Slice:<\/font><input type=checkbox name=multi><\/td>\
<td><font face='Arial' size=3>Cube Orient:<\/font><input type=checkbox name=cubori><\/td>\
<td><input type='submit' value='Scramble!' name=subbutton><\/td>\
<td><font face='Arial' size=2><a href='javascript:help();'>Help!<\/a><\/font><\/td>\
<\/tr><\/table><\/td><\/tr>\
");

scramble();
for( var i=0; i<numcub; i++){
	document.writeln("<tr><td><font face='Arial' size=3><b>"+(i+1)+".<\/b><\/font><\/td><td width=100%><font face='Arial' size=3><b>&nbsp;&nbsp;"+scramblestring(i)+"<\/b><\/font><\/td><td bgcolor=silver align=center>"+imagestring(i)+"<\/td><\/tr>");
}
document.writeln("<\/table><\/form>");

//-->
</script>
<font face='Arial' size=2>version: January 25, 2009</font>
</body></html>
```

HTML code for Megaminx scrambling


```
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title>Megaminx scrambler</title>

<script language="JavaScript1.1" type="text/javascript">
<!--

var linelen=10;
var linenbr=7;
var numcub=3;

var seq=new Array();	// move sequences

function parse() {
	var urlquery=location.href.split("?")
	if(urlquery.length>1){
		var urlterms=urlquery[1].split("&")
		for( var i=0; i<urlterms.length; i++){
			var urllr=urlterms[i].split("=");
			if(urllr[0]=="ll") {
				if(urllr[1]-0 >= 1 ) linelen=urllr[1]-0;
			} else if(urllr[0]=="ln"){
				if(urllr[1]-0 >= 1 ) linenbr=urllr[1]-0;
			} else if(urllr[0]=="num"){
				if(urllr[1]-0 >= 1 ) numcub=urllr[1]-0;
			}
		}
	}
}
parse();

function scramble(){
	var i,n;
	for( n=0; n<numcub; n++){
		seq[n]=new Array();
		for(i=0; i<linenbr*linelen; i++){
			seq[n][i]=Math.floor(Math.random()*2);
				}
	}
}

function scramblestring(n){
	var s="<br>&nbsp;&nbsp;",i,j;
	for(j=0; j<linenbr; j++){
		for(i=0; i<linelen; i++){
			if (i%2)
			{
				if (seq[n][j*linelen + i]) s+="D++ ";
				else s+="D-- ";
			}
			else
			{
				if (seq[n][j*linelen + i]) s+="R++ ";
				else s+="R-- ";
			}
		}
		if (seq[n][(j+1)*linelen - 1]) s+="U<br>&nbsp;&nbsp;";
		else s+="U'<br>&nbsp;&nbsp;";
	}
	return s;
}


//-->
</script>
</head>

<body bgcolor="white">

<form name="frm">
<table border=1 cellpadding=0 cellspacing=0 width='100%'><tr>
<td colspan=3 bgcolor='#00c0c0'>
<table width='100%' cellpadding=2 cellspacing=0><tr>
<td>Number of scrambles:<input name=num size=2 maxlength=2></td>
<td>Line length:<input name=ll size=2 maxlength=3></td>
<td>Line number:<input name=ln size=2 maxlength=3></td>
<td><input type='submit' value='Scramble!' name=subbutton></td>
</tr></table></td></tr>
<script language="JavaScript1.1" type="text/javascript">
<!--
document.frm.ll.value=linelen;
document.frm.ln.value=linenbr;
document.frm.num.value=numcub;


scramble();
for( var i=0; i<numcub; i++){
	document.writeln('<tr><td><b>'+(i+1)+'.</b></td><td width=100%><font face="courier"><b>'+scramblestring(i)+'</b></font></td></tr>');
}


//-->
</script>
</table></form>
<br>
Notation:<br>
D means all layers below the U face together in one move.<br>
R means all layers right from the L face together in one move.<br>
++ means 2/5 move clockwise (144 degrees), -- means 2/5 move counterclockwise (-144 degrees).<br>
U is the regular move of the U face, according to standard cube notation.<br>
<br>
Program by Clément Gallet, based on earlier work by Jaap Scherphuis. Idea by Stefan Pochmann.

</body>
</html>
```

HTML code for Square-1 scrambling


```
<!-- saved from url=(0022)http://internet.e-mail -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title>Square-1 scrambler</title>

<script language="JavaScript1.1" type="text/javascript">
<!--
/* Javascript written by Jaap Scherphuis,  jaapsch a t yahoo d o t com */
var seqlen=40;
var numcub=5;

var seq=new Array();    // move sequences
var posit = new Array();    // piece array

function parse() {
    var s="";
    var urlquery=location.href.split("?")
    if(urlquery.length>1){
        var urlterms=urlquery[1].split("&")
        for( var i=0; i<urlterms.length; i++){
            var urllr=urlterms[i].split("=");
            if(urllr[0]=="len") {
                if(urllr[1]-0 >= 1 ) seqlen=urllr[1]-0;
            } else if(urllr[0]=="num"){
                if(urllr[1]-0 >= 1 ) numcub=urllr[1]-0;
            }
        }
    }
}
parse();

function scramble(){
    var i,j,ls,n,f;
    for( n=0; n<numcub; n++){
        posit = new Array(0,0,1,2,2,3,4,4,5,6,6,7,8,9,9,10,11,11,12,13,13,14,15,15);
        ls=-1;
        seq[n]=new Array();
        f=0;
        for(i=0; i<seqlen; i++){
            do{
                if(ls==0){
                    j=Math.floor(Math.random()*22)-11;
                    if(j>=0) j++;
                }else if(ls==1){
                    j=Math.floor(Math.random()*12)-11;
                }else if(ls==2){
                    j=0;
                }else{
                    j=Math.floor(Math.random()*23)-11;
                }
                // if past second twist, restrict bottom layer
            }while( (f>1 && j>=-6 && j<0) || domove(j) );
            if(j>0) ls=1;
            else if(j<0) ls=2;
            else { ls=0; f++; }
            seq[n][i]=j;
        }
    }
}

function scramblestring(n){
    var s="",i,k,l=-1;
    for(i=0; i<seq[n].length; i++){
        k=seq[n][i];
        if(k==0){
            if(l==-1) s+="(0,0)  ";
            if(l==1) s+="0)  ";
            if(l==2) s+=")  ";
            l=0;
        }else if(k>0){
            s+= "(" + (k>6?k-12:k)+",";
            l=1;
        }else if(k<0){
            if(l<=0) s+="(0,";
            s+=(k<=-6?k+12:k);
            l=2;
        }
    }
    if(l==1) s+="0";
    if(l!=0) s+=")";
    //if(l==0) s+="(0,0)";
    return s+"<br><br>";
}


function domove(m){
    var i,c,t,f=m;
    //do move f
    if( f==0 ){
        for(i=0; i<6; i++){
            c=posit[i+12];
            posit[i+12]=posit[i+6];
            posit[i+6]=c;
        }
    }else if(f>0){
        f=12-f;
        if( posit[f]==posit[f-1] ) return true;
        if( f<6 && posit[f+6]==posit[f+5] ) return true;
        if( f>6 && posit[f-6]==posit[f-7] ) return true;
        if( f==6 && posit[0]==posit[11] ) return true;
        t=new Array();
        for(i=0;i<12;i++) t[i]=posit[i];
        c=f;
        for(i=0;i<12;i++){
            posit[i]=t[c];
            if(c==11)c=0; else c++;
        }
    }else if(f<0){
        f=-f;
        if( posit[f+12]==posit[f+11] ) return true;
        if( f<6 && posit[f+18]==posit[f+17] ) return true;
        if( f>6 && posit[f+6]==posit[f+5] ) return true;
        if( f==6 && posit[12]==posit[23] ) return true;
        t=new Array();
        for(i=0;i<12;i++) t[i]=posit[i+12];
        c=f;
        for(i=0;i<12;i++){
            posit[i+12]=t[c];
            if(c==11)c=0; else c++;
        }
    }
    return false;
}


//-->
</script>
</head>

<body bgcolor="white">

<form name="frm">
<table border=1 cellpadding=0 cellspacing=0 width="100%">
<tr>
<td colspan=2 bgcolor='#00c0c0'>
    <table width="100%">
    <tr>
        <td><font face="Arial" size=3>Number of scrambles:</font><input name=num size=4 maxlength=2></td>
        <td><font face="Arial" size=3>Scramble length:</font><input name=len size=4 maxlength=3></td>
    <td><input type="submit" value="Scramble!"></td>
    </tr>
    </table>
</td>
</tr>

<script language="JavaScript1.1" type="text/javascript">
<!--
document.frm.len.value=seqlen;
document.frm.num.value=numcub;

scramble();
for( var i=0; i<numcub; i++){
    document.writeln("<tr><td><font face='Arial' size=3><b>&nbsp;&nbsp;"+scramblestring(i)+"<\/b><\/font><\/td></tr>");
}

//-->
</script>
</table></form>

<font face='Arial' size=2>version: February 6, 2009</font>

</body>
</html>
```

HTML code for Pyraminx scrambling


```
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title>Pyraminx scrambler (Uniform Random-State)</title>

<script language="JavaScript1.1" type="text/javascript">
<!--
/* Base script written by Jaap Scherphuis, jaapsch a t yahoo d o t com */
/* Javascript written by Syoji Takamatsu, , red_dragon a t honki d o t net */
/* Random-State modification by Lucas Garron (lucasg a t gmx d o t de / garron.us) in collaboration with Michael Gottlieb (mzrg.com)*/
/* Version 1.0*/

var seqlen = 20;
var numcub = 5;

var colorString = "gryb";  //In dlburf order. May use any colours in colorList below

// list of available colours
var colorList = new Array(
	'g', "green",  "green",
	'r', "red",    "red",
	'y', "yellow", "yellow",
	'b', "blue",   "blue",
	'w', "white",  "white",
	'o', "#ff8000","orange",   // 'orange' is not an official html colour name
	'p', "purple", "purple",
	'0', "gray",   "grey"      // used for unrecognised letters, or when zero used.
);
// layout
var layout = new Array(
	1,2,1,2,1,0,2,0,1,2,1,2,1,
	0,1,2,1,0,2,1,2,0,1,2,1,0,
	0,0,1,0,2,1,2,1,2,0,1,0,0,
	0,0,0,0,0,0,0,0,0,0,0,0,0,
	0,0,0,0,1,2,1,2,1,0,0,0,0,
	0,0,0,0,0,1,2,1,0,0,0,0,0,
	0,0,0,0,0,0,1,0,0,0,0,0,0
);

var seq   = new Array();	// move sequences
var colmap = new Array();	// color map
var colors = new Array(); //stores colours used

function parse() {
	var s = "";
	var urlquery = location.href.split("?")
	if(urlquery.length > 1) {
		var urlterms = urlquery[1].split("&")
		for( var i = 0; i < urlterms.length; i++) {
			var urllr = urlterms[i].split("=");
			if(urllr[0] == "len") {
				if(urllr[1]-0 >= 1 ) 
					seqlen = urllr[1] - 0;
			} 
			else if(urllr[0] == "num") {
				if(urllr[1] - 0 >= 1 ) 
					numcub = urllr[1] - 0;
			} 
			else if(urllr[0] == "col") {
				if(urllr[1].length==4) 
					colorString = urllr[1];
			}
		}
	}
	// expand colour string into 6 actual html color names
	for(var k = 0; k < 6; k++){
		colors[k+1] = colorList.length - 3;	// gray
		for( var i = 0; i < colorList.length; i += 3) {
			if( colorString.charAt(k) == colorList[i]) {
				colors[k+1] = i;	// not use index 0
				break;
			}
		}
	}
}
parse();

function scramble()
{
	var i, j, n, ls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,2,0,2,3,1,0,1],[3,1,0,2,3,2,0,1,3,2,0,2,3,1,0,1],[3,1,0,2,3,2,2,1,0,2,2,2,0,2],[1,2,0,2,1,2,3,2,1,1,0,1,1,1,3,1],[3,2,0,2,3,2,0,1,3,2],[0,1,2,1,0,1,2,1,3,1,2,1,0,1,3,2],[3,1,0,1,1,2,0,2,1,1,3,2],[3,2,0,2,2,2,3,2,2,1,3,2,0,1],[3,2,1,1,3,2,1,2,3,2],[0,1,2,1,0,1,2,2,0,1],[0,1,1,1,2,2,1,1,0,1,2,1,0,1,1,1],[1,1,3,2,2,1,3,2,2,2,1,2,3,2],[1,1,3,1,1,2,3,2],[3,1,0,2,2,2,3,2,2,2,0,2,2,2,0,2],[3,1,1,2,0,1,1,1,0,2,3,2],[1,1,2,1,3,1,2,2,3,1,1,2,3,1],[3,1,1,1,3,2,1,1,0,1,1,1,0,2],[3,2,0,1,1,1,0,1,3,1,0,2,1,2,0,2],[3,2,0,2,2,2,3,2,2,1,0,1,3,2],[3,1,1,1,3,2,1,2,3,2,1,1,3,1,1,2],[0,2,3,2,0,1,3,1],[3,2,0,1,1,2,0,2,1,1,3,1],[3,2,1,1,2,1,3,1,2,1,1,1,2,1,1,1],[0,2,2,2,3,2,2,1,3,2,0,1,3,2],[3,1,0,2,3,1,0,1,3,1],[1,2,0,2,2,1,0,2,1,2,2,2,1,2,0,2],[1,2,2,2,1,2,2,1,1,2],[0,2,3,1,2,2,3,1,2,1,0,1,3,1],[3,2,0,2,3,1,0,2,1,2,0,2,1,1],[3,1,1,1,2,1,3,1,2,2,1,2,3,1],[3,1,1,2,0,2,1,2,3,2,1,1,0,1,1,1],[3,2,0,2,3,1,0,1,3,1,0,2,3,2,0,1]];


		var AUFs=[3,1,0,2,7,5,4,6];
		seq[n]=f2e[Math.floor(Math.random()*120)].concat(l4e[Math.floor(Math.random()*96)]);
		for(var i=0;i<8;i++){
			var dir=Math.floor(Math.random()*3);
			if(dir>0)
			seq[n]=seq[n].concat([AUFs[i],dir]);
		}
	}
}

function scramble_color()
{
	for( var n = 0; n < numcub; n++){
		for(var i = 0; i < seq[n].length; i += 2) {
			switch(seq[n][i]) {
				case 0:	// L
					rotate3(n, 14,58,18, seq[n][i + 1]);
					rotate3(n, 15,57,31, seq[n][i + 1]);
					rotate3(n, 16,70,32, seq[n][i + 1]);
					rotate3(n, 30,28,56, seq[n][i + 1]);
					break;
				case 1:	// R
					rotate3(n, 32,72,22, seq[n][i + 1]);
					rotate3(n, 33,59,23, seq[n][i + 1]);
					rotate3(n, 20,58,24, seq[n][i + 1]);
					rotate3(n, 34,60,36, seq[n][i + 1]);
					break;
				case 2:	// B
					rotate3(n, 14,10,72, seq[n][i + 1]);
					rotate3(n,  1,11,71, seq[n][i + 1]);
					rotate3(n,  2,24,70, seq[n][i + 1]);
					rotate3(n,  0,12,84, seq[n][i + 1]);
					break;
				case 3:	// U
					rotate3(n,  2,18,22, seq[n][i + 1]);
					rotate3(n,  3,19, 9, seq[n][i + 1]);
					rotate3(n, 16,20,10, seq[n][i + 1]);
					rotate3(n,  4, 6, 8, seq[n][i + 1]);
					break;
				case 4:	// l
					rotate3(n, 30,28,56, seq[n][i + 1]);
					break;
				case 5:	// r
					rotate3(n, 34,60,36, seq[n][i + 1]);
					break;
				case 6:	// b
					rotate3(n,  0,12,84, seq[n][i + 1]);
					break;
				case 7:	// u
					rotate3(n,  4, 6, 8, seq[n][i + 1]);
					break;
			}
		}
	}
}

function rotate3(n, v1, v2, v3, clockwise)
{
	var tmp;

	if(clockwise == 2) { //	un
		tmp = colmap[n][v3];
		colmap[n][v3] = colmap[n][v2];
		colmap[n][v2] = colmap[n][v1];
		colmap[n][v1] = tmp;
	}
	else {
		tmp = colmap[n][v1];
		colmap[n][v1] = colmap[n][v2];
		colmap[n][v2] = colmap[n][v3];
		colmap[n][v3] = tmp;
	}
}

function scramblestring(n)
{
	var s = "", i;
	for(i = 0; i < seq[n].length; i += 2) {
		s += "LRBUlrbu".charAt(seq[n][i]);
		if( seq[n][i + 1] == 2 )
			s += "'";
		s += " ";
	}
	do {} while (s != (s=s.replace(/(.) \1 /g,"$1' ").replace(/(.)' \1' /g,"$1 ").replace(/(.)' \1 /g,"").replace(/(.) \1' /g,"")));
	return s;
}

function draw_triangle(pat, color, val)
{
	var s = "";
	if(pat == 1) {
		s += "<table border=0 cellpadding=0 cellspacing=0>";
		s += "<tr><td colspan=12 width=12 height=2 bgcolor=" + colorList[colors[color] + 2] + ">" + val+  "</td></tr>";

		for(var i = 1; i <= 5; i++) {
			s += "<tr>";
			s += "<td colspan=" + i + " width=" + i + " height=2 bgcolor=silver></td>";
			s += "<td colspan=" + (12 - i * 2) + " width=" + (12 - i * 2) + " height=2 bgcolor=" + colorList[colors[color] + 2] + "></td>";
			s += "<td colspan=" + i + " width=" + i + " height=2 bgcolor=silver></td>";
			s += "</tr>";
		}

		s += "</table>";
	}
	else if(pat == 2) {
		s += "<table border=0 cellpadding=0 cellspacing=0>";
		for(var i = 5; i >= 1; i--) {
			s += "<tr>";
			s += "<td colspan=" + i + " width=" + i + " height=2 bgcolor=silver></td>";
			s += "<td colspan=" + (12 - i * 2) + " width=" + (12 - i * 2) + " height=2 bgcolor=" + colorList[colors[color] + 2] + "></td>";
			s += "<td colspan=" + i + " width=" + i + " height=2 bgcolor=silver></td>";
			s += "</tr>";
		}
		s += "<tr><td colspan=12 width=12 height=2 bgcolor=" + colorList[colors[color] + 2] + ">" + val+  "</td></tr>";
		s += "</table>";
	}
	else {
		s += "&nbsp;";
	}
	return s;
}

function imagetable(n)
{
	var x,y;
	var s = "<table border=0 cellpadding=0 cellspacing=0>";

	for(var y = 0; y < 7; y++) {
		s += "<tr>";
		for(var x = 0; x < 13; x++) {
			s += "<td>";
			s += draw_triangle(layout[y * 13 + x], colmap[n][y * 13 + x]                , "");
			s += "</td>";
		}
		s += "</tr>";
	}
	s += "</table>";
	return s;
}


//-->
</script>
</head>

<body bgcolor="white">

<form name="frm">
<table border=1 cellpadding=0 cellspacing=0 width="100%"><tr>
<td colspan=3 bgcolor='#00c0c0'>
<table width="100%"><tr>
<td bgcolor=white align=center rowspan=2><img src="pyraminx.gif" width=163 height=142 alt=""></td>
<td><font face="Arial" size=3>Number of scrambles:</font><input name=num size="4" maxlength="2"></td>

<td><font face="Arial" size=3>Uniform Random-State Scrambles<br>Generated <script language="JavaScript1.1" type="text/javascript">
var d = new Date();
document.write (d.toUTCString());
</script></font></td>
<td><font face='Arial' size=3>Colours (LFRD):</font><input name="col" size="6" maxlength="6"></td>
<td><input type="submit" value="Scramble!"></td>
</tr>
<tr><td colspan="5">Note:<br>Small letter: Rotate a vertex piece, Capital letter: Rotate two layers at once.</td></tr>
</table></td></tr>

<script language="JavaScript1.1" type="text/javascript">
<!--
document.frm.num.value = numcub;
document.frm.col.value = colorString;

scramble();
scramble_color();
for( var i = 0; i < numcub; i++) {
	document.writeln("<tr><td align='center'><font face='Arial' size='3'><b>"+eval(eval(i)+1)+".</b></font></td><td><font face='Arial' size='3'><b>&nbsp;&nbsp;"+scramblestring(i)+"</b></font></td><td bgcolor='silver' align='center'>" +imagetable(i)+ "</td></tr>");
}

//-->
</script>

</table></form>
<font face="Arial" size="2">version: February 6, 2009</font>
</body>
</html>
```

All code taken directly from WCA website.


----------



## StachuK1992 (Jun 6, 2009)

or you could have just have given him a link...


----------



## Johannes91 (Jun 6, 2009)

You could modify the JavaScript to print plain text and run them with some JavaScript interpreter.


----------



## PatrickJameson (Jun 6, 2009)

byu said:


> HTML code for nxnxn sized cubes
> 
> 
> ```
> ...



Nice job pasting the entire html code.FAIL.


----------



## StachuK1992 (Jun 6, 2009)

Patrick...you just did the same thing. :/
I hate scrolling. grr.


----------



## Tortin (Jun 6, 2009)

Nice job quoting the whole code. FAIL.


----------



## PatrickJameson (Jun 6, 2009)

Stachuk1992 said:


> Patrick...you just did the same thing. :/
> I hate scrolling. grr.



Yeah, I did that on purpose.


----------



## TomZ (Jun 6, 2009)

Edit that post to remove the code, PLEASE! It doesn't add anything at all to the topic (it is three clicks away anyway) and it is super annoying.

Your answer is: WGet/WinHTTPReq isn't going to work. The scrambles are generated on your computer (trough the browser), not on the WCA server.

You have two options, I think. There is a way to create a hidden instance of IE and interface with it trough programming languages. You could also try ripping apart the code and translating it to something your language can understand or stripping it down far enough to use ScriptControl to execute it from your programming environment.


----------



## h5n1 (Jun 6, 2009)

You might want to use a pastebin and provide a link to that code. Did you try using curl for the script?


----------



## Johannes91 (Jun 6, 2009)

Making the JavaScript run outside a browser isn't hard at all. (Though it would be a bit easier if it didn't look like it had been deliberately obfuscated. There are some real wtfs.)

For example, here's the Pyraminx scrambler: http://codepad.org/aLpmOspV.

Running with Rhino:


```
$ js
js> load("jstest.js")
js> for (var i = 0; i < 5; ++i) { print(scramble_to_string(get_scramble())) }
L' R' U L R U' L R U R' U' L' U' R b'
L R U' L' U R' U' R U' B U' B' R' U' R L l' b'
L U' R' U R' L' R' L B L B' L U' L B u l'
R U L' R' L U' R' L' U' L U R U L' B' u' r l' b'
U R L' U' R' L U L' U L U' R U R' U' B' r' l' b'
```


----------



## rwcinoto (Jun 6, 2009)

Thanks for the pastings, he he. I'll try to use curl or Rhino and if I can't I'll try to convert the codes to VBA in Excel.


----------

