
geekboy possible shuffle
By: a guest on
Apr 10th, 2010 | syntax:
None | size: 0.50 KB | hits: 108 | expires: Never
been googling found this ^_^
public void scramble() // Called from the outside
{
int i,j,k,l;
if (!automatic)
{
for (i=0;i<4;i++)
for (j=0;j<4;j++)
map[7+i*6+j]=(i*4+j+1)&15;
for (i=0;i<16;i++)
{
l=(randi()>>5)%15;
j=7+6*(l/4)+(l&3);
l=(randi()>>5)%15;
k=7+6*(l/4)+(l&3);
while (k==j)
{
l=(randi()>>5)%15;
k=7+6*(l/4)+(l&3);
}
l=map[k];
map[k]=map[j];
map[j]=l;
}
buildBackground();
repaint();
}
}