$len) break;
}
} else {
$now = $c;
if ($c2 == "'") $now .= $c2;
if ($c2 == "2") $now .= $c2;
}
$ufrlbd = unit_operation($now, $u, $f, $r, $l, $b, $d);
$u = substr($ufrlbd, 0, 9);
$f = substr($ufrlbd, 9, 9);
$r = substr($ufrlbd, 18, 9);
$l = substr($ufrlbd, 27, 9);
$b = substr($ufrlbd, 36, 9);
$d = substr($ufrlbd, 45, 9);
}
return $u . $f . $r . $l . $b . $d;
}
function unit_operation($op, $u, $f, $r, $l, $b, $d) {
$nu = $u; $nf = $f; $nr = $r;
$nl = $l; $nb = $b; $nd = $d;
// echo "Now : " . $op . "
";
if ($op == 'F') {
$nf = substr($f, 6, 1) . substr($f, 3, 1) . substr($f, 0, 1) .
substr($f, 7, 1) . substr($f, 4, 1) . substr($f, 1, 1) .
substr($f, 8, 1) . substr($f, 5, 1) . substr($f, 2, 1);
$nu = substr($u, 0, 6) . substr($l, 6, 3);
$nr = substr($r, 0, 6) . substr($u, 6, 3);
$nd = substr($d, 0, 6) . substr($r, 6, 3);
$nl = substr($l, 0, 6) . substr($d, 6, 3);
} elseif ($op == "F'") {
$nf = substr($f, 2, 1) . substr($f, 5, 1) . substr($f, 8, 1) .
substr($f, 1, 1) . substr($f, 4, 1) . substr($f, 7, 1) .
substr($f, 0, 1) . substr($f, 3, 1) . substr($f, 6, 1);
$nu = substr($u, 0, 6) . substr($r, 6, 3);
$nr = substr($r, 0, 6) . substr($d, 6, 3);
$nd = substr($d, 0, 6) . substr($l, 6, 3);
$nl = substr($l, 0, 6) . substr($u, 6, 3);
} elseif ($op == "F2") {
$nf = substr($f, 8, 1) . substr($f, 7, 1) . substr($f, 6, 1) .
substr($f, 5, 1) . substr($f, 4, 1) . substr($f, 3, 1) .
substr($f, 2, 1) . substr($f, 1, 1) . substr($f, 0, 1);
$nu = substr($u, 0, 6) . substr($d, 6, 3);
$nr = substr($r, 0, 6) . substr($l, 6, 3);
$nd = substr($d, 0, 6) . substr($u, 6, 3);
$nl = substr($l, 0, 6) . substr($r, 6, 3);
} elseif ($op == "U") {
$nu = substr($u, 6, 1) . substr($u, 3, 1) . substr($u, 0, 1) .
substr($u, 7, 1) . substr($u, 4, 1) . substr($u, 1, 1) .
substr($u, 8, 1) . substr($u, 5, 1) . substr($u, 2, 1);
$nr = substr($b, 6, 1) . substr($r, 1, 2) .
substr($b, 7, 1) . substr($r, 4, 2) .
substr($b, 8, 1) . substr($r, 7, 2);
$nf = substr($r, 6, 1) . substr($r, 3, 1) . substr($r, 0, 1) .
substr($f, 3, 6);
$nl = substr($l, 0, 2) . substr($f, 0, 1) .
substr($l, 3, 2) . substr($f, 1, 1) .
substr($l, 6, 2) . substr($f, 2, 1);
$nb = substr($b, 0, 6) . substr($l, 8, 1) .
substr($l, 5, 1) . substr($l, 2, 1);
} elseif ($op == "U'") {
$nu = substr($u, 2, 1) . substr($u, 5, 1) . substr($u, 8, 1) .
substr($u, 1, 1) . substr($u, 4, 1) . substr($u, 7, 1) .
substr($u, 0, 1) . substr($u, 3, 1) . substr($u, 6, 1);
$nr = substr($f, 2, 1) . substr($r, 1, 2) .
substr($f, 1, 1) . substr($r, 4, 2) .
substr($f, 0, 1) . substr($r, 7, 2);
$nf = substr($l, 2, 1) . substr($l, 5, 1) . substr($l, 8, 1) .
substr($f, 3, 6);
$nl = substr($l, 0, 2) . substr($b, 8, 1) .
substr($l, 3, 2) . substr($b, 7, 1) .
substr($l, 6, 2) . substr($b, 6, 1);
$nb = substr($b, 0, 6) . substr($r, 0, 1) .
substr($r, 3, 1) . substr($r, 6, 1);
} elseif ($op == "U2") {
$nu = substr($u, 8, 1) . substr($u, 7, 1) . substr($u, 6, 1) .
substr($u, 5, 1) . substr($u, 4, 1) . substr($u, 3, 1) .
substr($u, 2, 1) . substr($u, 1, 1) . substr($u, 0, 1);
$nr = substr($l, 8, 1) . substr($r, 1, 2) .
substr($l, 5, 1) . substr($r, 4, 2) .
substr($l, 2, 1) . substr($r, 7, 2);
$nf = substr($b, 8, 1) . substr($b, 7, 1) . substr($b, 6, 1) .
substr($f, 3, 6);
$nl = substr($l, 0, 2) . substr($r, 6, 1) .
substr($l, 3, 2) . substr($r, 3, 1) .
substr($l, 6, 2) . substr($r, 0, 1);
$nb = substr($b, 0, 6) . substr($f, 2, 1) .
substr($f, 1, 1) . substr($f, 0, 1);
} elseif ($op == "R") {
$nr = substr($r, 6, 1) . substr($r, 3, 1) . substr($r, 0, 1) .
substr($r, 7, 1) . substr($r, 4, 1) . substr($r, 1, 1) .
substr($r, 8, 1) . substr($r, 5, 1) . substr($r, 2, 1);
$nu = substr($u, 0, 2) . substr($f, 2, 1) .
substr($u, 3, 2) . substr($f, 5, 1) .
substr($u, 6, 2) . substr($f, 8, 1);
$nf = substr($f, 0, 2) . substr($d, 6, 1) .
substr($f, 3, 2) . substr($d, 3, 1) .
substr($f, 6, 2) . substr($d, 0, 1);
$nd = substr($b, 8, 1) . substr($d, 1, 2) .
substr($b, 5, 1) . substr($d, 4, 2) .
substr($b, 2, 1) . substr($d, 7, 2);
$nb = substr($b, 0, 2) . substr($u, 2, 1) .
substr($b, 3, 2) . substr($u, 5, 1) .
substr($b, 6, 2) . substr($u, 8, 1);
} elseif ($op == "R'") {
$nr = substr($r, 2, 1) . substr($r, 5, 1) . substr($r, 8, 1) .
substr($r, 1, 1) . substr($r, 4, 1) . substr($r, 7, 1) .
substr($r, 0, 1) . substr($r, 3, 1) . substr($r, 6, 1);
$nu = substr($u, 0, 2) . substr($b, 2, 1) .
substr($u, 3, 2) . substr($b, 5, 1) .
substr($u, 6, 2) . substr($b, 8, 1);
$nf = substr($f, 0, 2) . substr($u, 2, 1) .
substr($f, 3, 2) . substr($u, 5, 1) .
substr($f, 6, 2) . substr($u, 8, 1);
$nd = substr($f, 8, 1) . substr($d, 1, 2) .
substr($f, 5, 1) . substr($d, 4, 2) .
substr($f, 2, 1) . substr($d, 7, 2);
$nb = substr($b, 0, 2) . substr($d, 6, 1) .
substr($b, 3, 2) . substr($d, 3, 1) .
substr($b, 6, 2) . substr($d, 0, 1);
} elseif ($op == "R2") {
$nr = substr($r, 8, 1) . substr($r, 7, 1) . substr($r, 6, 1) .
substr($r, 5, 1) . substr($r, 4, 1) . substr($r, 3, 1) .
substr($r, 2, 1) . substr($r, 1, 1) . substr($r, 0, 1);
$nu = substr($u, 0, 2) . substr($d, 6, 1) .
substr($u, 3, 2) . substr($d, 3, 1) .
substr($u, 6, 2) . substr($d, 0, 1);
$nf = substr($f, 0, 2) . substr($b, 2, 1) .
substr($f, 3, 2) . substr($b, 5, 1) .
substr($f, 6, 2) . substr($b, 8, 1);
$nd = substr($u, 8, 1) . substr($d, 1, 2) .
substr($u, 5, 1) . substr($d, 4, 2) .
substr($u, 2, 1) . substr($d, 7, 2);
$nb = substr($b, 0, 2) . substr($f, 2, 1) .
substr($b, 3, 2) . substr($f, 5, 1) .
substr($b, 6, 2) . substr($f, 8, 1);
} elseif ($op == "L") {
$nl = substr($l, 6, 1) . substr($l, 3, 1) . substr($l, 0, 1) .
substr($l, 7, 1) . substr($l, 4, 1) . substr($l, 1, 1) .
substr($l, 8, 1) . substr($l, 5, 1) . substr($l, 2, 1);
$nu = substr($b, 0, 1) . substr($u, 1, 2) .
substr($b, 3, 1) . substr($u, 4, 2) .
substr($b, 6, 1) . substr($u, 7, 2);
$nf = substr($u, 0, 1) . substr($f, 1, 2) .
substr($u, 3, 1) . substr($f, 4, 2) .
substr($u, 6, 1) . substr($f, 7, 2);
$nd = substr($d, 0, 2) . substr($f, 6, 1) .
substr($d, 3, 2) . substr($f, 3, 1) .
substr($d, 6, 2) . substr($f, 0, 1);
$nb = substr($d, 8, 1) . substr($b, 1, 2) .
substr($d, 5, 1) . substr($b, 4, 2) .
substr($d, 2, 1) . substr($b, 7, 2);
} elseif ($op == "L'") {
$nl = substr($l, 2, 1) . substr($l, 5, 1) . substr($l, 8, 1) .
substr($l, 1, 1) . substr($l, 4, 1) . substr($l, 7, 1) .
substr($l, 0, 1) . substr($l, 3, 1) . substr($l, 6, 1);
$nu = substr($f, 0, 1) . substr($u, 1, 2) .
substr($f, 3, 1) . substr($u, 4, 2) .
substr($f, 6, 1) . substr($u, 7, 2);
$nf = substr($d, 8, 1) . substr($f, 1, 2) .
substr($d, 5, 1) . substr($f, 4, 2) .
substr($d, 2, 1) . substr($f, 7, 2);
$nd = substr($d, 0, 2) . substr($b, 6, 1) .
substr($d, 3, 2) . substr($b, 3, 1) .
substr($d, 6, 2) . substr($b, 0, 1);
$nb = substr($u, 0, 1) . substr($b, 1, 2) .
substr($u, 3, 1) . substr($b, 4, 2) .
substr($u, 6, 1) . substr($b, 7, 2);
} elseif ($op == "L2") {
$nl = substr($l, 8, 1) . substr($l, 7, 1) . substr($l, 6, 1) .
substr($l, 5, 1) . substr($l, 4, 1) . substr($l, 3, 1) .
substr($l, 2, 1) . substr($l, 1, 1) . substr($l, 0, 1);
$nu = substr($d, 8, 1) . substr($u, 1, 2) .
substr($d, 5, 1) . substr($u, 4, 2) .
substr($d, 2, 1) . substr($u, 7, 2);
$nf = substr($b, 0, 1) . substr($f, 1, 2) .
substr($b, 3, 1) . substr($f, 4, 2) .
substr($b, 6, 1) . substr($f, 7, 2);
$nd = substr($d, 0, 2) . substr($u, 6, 1) .
substr($d, 3, 2) . substr($u, 3, 1) .
substr($d, 6, 2) . substr($u, 0, 1);
$nb = substr($f, 0, 1) . substr($b, 1, 2) .
substr($f, 3, 1) . substr($b, 4, 2) .
substr($f, 6, 1) . substr($b, 7, 2);
} elseif ($op == "B") {
$nb = substr($b, 6, 1) . substr($b, 3, 1) . substr($b, 0, 1) .
substr($b, 7, 1) . substr($b, 4, 1) . substr($b, 1, 1) .
substr($b, 8, 1) . substr($b, 5, 1) . substr($b, 2, 1);
$nu = substr($r, 0, 3) . substr($u, 3, 6);
$nr = substr($d, 0, 3) . substr($r, 3, 6);
$nd = substr($l, 0, 3) . substr($d, 3, 6);
$nl = substr($u, 0, 3) . substr($l, 3, 6);
} elseif ($op == "B'") {
$nb = substr($b, 2, 1) . substr($b, 5, 1) . substr($b, 8, 1) .
substr($b, 1, 1) . substr($b, 4, 1) . substr($b, 7, 1) .
substr($b, 0, 1) . substr($b, 3, 1) . substr($b, 6, 1);
$nu = substr($l, 0, 3) . substr($u, 3, 6);
$nr = substr($u, 0, 3) . substr($r, 3, 6);
$nd = substr($r, 0, 3) . substr($d, 3, 6);
$nl = substr($d, 0, 3) . substr($l, 3, 6);
} elseif ($op == "B2") {
$nb = substr($b, 8, 1) . substr($b, 7, 1) . substr($b, 6, 1) .
substr($b, 5, 1) . substr($b, 4, 1) . substr($b, 3, 1) .
substr($b, 2, 1) . substr($b, 1, 1) . substr($b, 0, 1);
$nu = substr($d, 0, 3) . substr($u, 3, 6);
$nr = substr($l, 0, 3) . substr($r, 3, 6);
$nd = substr($u, 0, 3) . substr($d, 3, 6);
$nl = substr($r, 0, 3) . substr($l, 3, 6);
} elseif ($op == "D") {
$nd = substr($d, 6, 1) . substr($d, 3, 1) . substr($d, 0, 1) .
substr($d, 7, 1) . substr($d, 4, 1) . substr($d, 1, 1) .
substr($d, 8, 1) . substr($d, 5, 1) . substr($d, 2, 1);
$nf = substr($f, 0, 6) . substr($l, 0, 1) .
substr($l, 3, 1) . substr($l, 6, 1);
$nr = substr($r, 0, 2) . substr($f, 8, 1) .
substr($r, 3, 2) . substr($f, 7, 1) .
substr($r, 6, 2) . substr($f, 6, 1);
$nb = substr($r, 2, 1) . substr($r, 5, 1) .
substr($r, 8, 1) . substr($b, 3, 6);
$nl = substr($b, 2, 1) . substr($l, 1, 2) .
substr($b, 1, 1) . substr($l, 4, 2) .
substr($b, 0, 1) . substr($l, 7, 2);
} elseif ($op == "D'") {
$nd = substr($d, 2, 1) . substr($d, 5, 1) . substr($d, 8, 1) .
substr($d, 1, 1) . substr($d, 4, 1) . substr($d, 7, 1) .
substr($d, 0, 1) . substr($d, 3, 1) . substr($d, 6, 1);
$nf = substr($f, 0, 6) . substr($r, 8, 1) . substr($r, 5, 1) . substr($r, 2, 1);
$nr = substr($r, 0, 2) . substr($b, 0, 1) .
substr($r, 3, 2) . substr($b, 1, 1) .
substr($r, 6, 2) . substr($b, 2, 1);
$nb = substr($l, 6, 1) . substr($l, 3, 1) .
substr($l, 0, 1) . substr($b, 3, 6);
$nl = substr($f, 6, 1) . substr($l, 1, 2) .
substr($f, 7, 1) . substr($l, 4, 2) .
substr($f, 8, 1) . substr($l, 7, 2);
} elseif ($op == "D2") {
$nd = substr($d, 8, 1) . substr($d, 7, 1) . substr($d, 6, 1) .
substr($d, 5, 1) . substr($d, 4, 1) . substr($d, 3, 1) .
substr($d, 2, 1) . substr($d, 1, 1) . substr($d, 0, 1);
$nf = substr($f, 0, 6) . substr($b, 2, 1) . substr($b, 1, 1) . substr($b, 0, 1);
$nr = substr($r, 0, 2) . substr($l, 6, 1) .
substr($r, 3, 2) . substr($l, 3, 1) .
substr($r, 6, 2) . substr($l, 0, 1);
$nb = substr($f, 8, 1) . substr($f, 7, 1) .
substr($f, 6, 1) . substr($b, 3, 6);
$nl = substr($r, 8, 1) . substr($l, 1, 2) .
substr($r, 5, 1) . substr($l, 4, 2) .
substr($r, 2, 1) . substr($l, 7, 2);
} elseif ($op == "S") {
$nu = substr($u, 0, 3) . substr($l, 3, 3) . substr($u, 6, 3);
$nr = substr($r, 0, 3) . substr($u, 3, 3) . substr($r, 6, 3);
$nd = substr($d, 0, 3) . substr($r, 3, 3) . substr($d, 6, 3);
$nl = substr($l, 0, 3) . substr($d, 3, 3) . substr($l, 6, 3);
} elseif ($op == "S'") {
$nu = substr($u, 0, 3) . substr($r, 3, 3) . substr($u, 6, 3);
$nr = substr($r, 0, 3) . substr($d, 3, 3) . substr($r, 6, 3);
$nd = substr($d, 0, 3) . substr($l, 3, 3) . substr($d, 6, 3);
$nl = substr($l, 0, 3) . substr($u, 3, 3) . substr($l, 6, 3);
} elseif ($op == "S2") {
$nu = substr($u, 0, 3) . substr($d, 3, 3) . substr($u, 6, 3);
$nr = substr($r, 0, 3) . substr($l, 3, 3) . substr($r, 6, 3);
$nd = substr($d, 0, 3) . substr($u, 3, 3) . substr($d, 6, 3);
$nl = substr($l, 0, 3) . substr($r, 3, 3) . substr($l, 6, 3);
} elseif ($op == "M") {
$nu = substr($u, 0, 1) . substr($b, 1, 1) . substr($u, 2, 2) .
substr($b, 4, 1) . substr($u, 5, 2) . substr($b, 7, 1) . substr($u, 8, 1);
$nf = substr($f, 0, 1) . substr($u, 1, 1) . substr($f, 2, 2) .
substr($u, 4, 1) . substr($f, 5, 2) . substr($u, 7, 1) . substr($f, 8, 1);
$nd = substr($d, 0, 1) . substr($f, 7, 1) . substr($d, 2, 2) .
substr($f, 4, 1) . substr($d, 5, 2) . substr($f, 1, 1) . substr($d, 8, 1);
$nb = substr($b, 0, 1) . substr($d, 7, 1) . substr($b, 2, 2) .
substr($d, 4, 1) . substr($b, 5, 2) . substr($d, 1, 1) . substr($b, 8, 1);
} elseif ($op == "M'") {
$nu = substr($u, 0, 1) . substr($f, 1, 1) . substr($u, 2, 2) .
substr($f, 4, 1) . substr($u, 5, 2) . substr($f, 7, 1) . substr($u, 8, 1);
$nf = substr($f, 0, 1) . substr($d, 7, 1) . substr($f, 2, 2) .
substr($d, 4, 1) . substr($f, 5, 2) . substr($d, 1, 1) . substr($f, 8, 1);
$nd = substr($d, 0, 1) . substr($b, 7, 1) . substr($d, 2, 2) .
substr($b, 4, 1) . substr($d, 5, 2) . substr($b, 1, 1) . substr($d, 8, 1);
$nb = substr($b, 0, 1) . substr($u, 1, 1) . substr($b, 2, 2) .
substr($u, 4, 1) . substr($b, 5, 2) . substr($u, 7, 1) . substr($b, 8, 1);
} elseif ($op == "M2") {
$nu = substr($u, 0, 1) . substr($d, 7, 1) . substr($u, 2, 2) .
substr($d, 4, 1) . substr($u, 5, 2) . substr($d, 1, 1) . substr($u, 8, 1);
$nf = substr($f, 0, 1) . substr($b, 1, 1) . substr($f, 2, 2) .
substr($b, 4, 1) . substr($f, 5, 2) . substr($b, 7, 1) . substr($f, 8, 1);
$nd = substr($d, 0, 1) . substr($u, 7, 1) . substr($d, 2, 2) .
substr($u, 4, 1) . substr($d, 5, 2) . substr($u, 1, 1) . substr($d, 8, 1);
$nb = substr($b, 0, 1) . substr($f, 1, 1) . substr($b, 2, 2) .
substr($f, 4, 1) . substr($b, 5, 2) . substr($f, 7, 1) . substr($b, 8, 1);
} elseif ($op == "E") {
$nf = substr($f, 0, 3) . substr($l, 1, 1) . substr($l, 4, 1) .
substr($l, 7, 1) . substr($f, 6, 3);
$nr = substr($r, 0, 1) . substr($f, 5, 1) . substr($r, 2, 2) .
substr($f, 4, 1) . substr($r, 5, 2) . substr($f, 3, 1) . substr($r, 8, 1);
$nb = substr($b, 0, 3) . substr($r, 1, 1) . substr($r, 4, 1) .
substr($r, 7, 1) . substr($b, 6, 3);
$nl = substr($l, 0, 1) . substr($b, 5, 1) . substr($l, 2, 2) .
substr($b, 4, 1) . substr($l, 5, 2) . substr($b, 3, 1) . substr($l, 8, 1);
} elseif ($op == "E'") {
$nf = substr($f, 0, 3) . substr($r, 7, 1) . substr($r, 4, 1) .
substr($r, 1, 1) . substr($f, 6, 3);
$nr = substr($r, 0, 1) . substr($b, 3, 1) . substr($r, 2, 2) .
substr($b, 4, 1) . substr($r, 5, 2) . substr($b, 5, 1) . substr($r, 8, 1);
$nb = substr($b, 0, 3) . substr($l, 7, 1) . substr($l, 4, 1) .
substr($l, 1, 1) . substr($b, 6, 3);
$nl = substr($l, 0, 1) . substr($f, 3, 1) . substr($l, 2, 2) .
substr($f, 4, 1) . substr($l, 5, 2) . substr($f, 5, 1) . substr($l, 8, 1);
} elseif ($op == "E2") {
$nf = substr($f, 0, 3) . substr($b, 5, 1) . substr($b, 4, 1) .
substr($b, 3, 1) . substr($f, 6, 3);
$nr = substr($r, 0, 1) . substr($l, 7, 1) . substr($r, 2, 2) .
substr($l, 4, 1) . substr($r, 5, 2) . substr($l, 1, 1) . substr($r, 8, 1);
$nb = substr($b, 0, 3) . substr($f, 5, 1) . substr($f, 4, 1) .
substr($f, 3, 1) . substr($b, 6, 3);
$nl = substr($l, 0, 1) . substr($r, 7, 1) . substr($l, 2, 2) .
substr($r, 4, 1) . substr($l, 5, 2) . substr($r, 1, 1) . substr($l, 8, 1);
} elseif (($op == "(u)") || ($op == "y")) {
$nu = substr($u, 6, 1) . substr($u, 3, 1) . substr($u, 0, 1) .
substr($u, 7, 1) . substr($u, 4, 1) . substr($u, 1, 1) .
substr($u, 8, 1) . substr($u, 5, 1) . substr($u, 2, 1);
$nf = substr($r, 6, 1) . substr($r, 3, 1) . substr($r, 0, 1) .
substr($r, 7, 1) . substr($r, 4, 1) . substr($r, 1, 1) .
substr($r, 8, 1) . substr($r, 5, 1) . substr($r, 2, 1);
$nr = substr($b, 6, 1) . substr($b, 3, 1) . substr($b, 0, 1) .
substr($b, 7, 1) . substr($b, 4, 1) . substr($b, 1, 1) .
substr($b, 8, 1) . substr($b, 5, 1) . substr($b, 2, 1);
$nb = substr($l, 6, 1) . substr($l, 3, 1) . substr($l, 0, 1) .
substr($l, 7, 1) . substr($l, 4, 1) . substr($l, 1, 1) .
substr($l, 8, 1) . substr($l, 5, 1) . substr($l, 2, 1);
$nl = substr($f, 6, 1) . substr($f, 3, 1) . substr($f, 0, 1) .
substr($f, 7, 1) . substr($f, 4, 1) . substr($f, 1, 1) .
substr($f, 8, 1) . substr($f, 5, 1) . substr($f, 2, 1);
$nd = substr($d, 2, 1) . substr($d, 5, 1) . substr($d, 8, 1) .
substr($d, 1, 1) . substr($d, 4, 1) . substr($d, 7, 1) .
substr($d, 0, 1) . substr($d, 3, 1) . substr($d, 6, 1);
} elseif (($op == "(u')") || ($op == "y'")) {
$nu = substr($u, 2, 1) . substr($u, 5, 1) . substr($u, 8, 1) .
substr($u, 1, 1) . substr($u, 4, 1) . substr($u, 7, 1) .
substr($u, 0, 1) . substr($u, 3, 1) . substr($u, 6, 1);
$nf = substr($l, 2, 1) . substr($l, 5, 1) . substr($l, 8, 1) .
substr($l, 1, 1) . substr($l, 4, 1) . substr($l, 7, 1) .
substr($l, 0, 1) . substr($l, 3, 1) . substr($l, 6, 1);
$nr = substr($f, 2, 1) . substr($f, 5, 1) . substr($f, 8, 1) .
substr($f, 1, 1) . substr($f, 4, 1) . substr($f, 7, 1) .
substr($f, 0, 1) . substr($f, 3, 1) . substr($f, 6, 1);
$nb = substr($r, 2, 1) . substr($r, 5, 1) . substr($r, 8, 1) .
substr($r, 1, 1) . substr($r, 4, 1) . substr($r, 7, 1) .
substr($r, 0, 1) . substr($r, 3, 1) . substr($r, 6, 1);
$nl = substr($b, 2, 1) . substr($b, 5, 1) . substr($b, 8, 1) .
substr($b, 1, 1) . substr($b, 4, 1) . substr($b, 7, 1) .
substr($b, 0, 1) . substr($b, 3, 1) . substr($b, 6, 1);
$nd = substr($d, 6, 1) . substr($d, 3, 1) . substr($d, 0, 1) .
substr($d, 7, 1) . substr($d, 4, 1) . substr($d, 1, 1) .
substr($d, 8, 1) . substr($d, 5, 1) . substr($d, 2, 1);
} elseif (($op == "(u2)") || ($op == "y2")) {
$nu = substr($u, 8, 1) . substr($u, 7, 1) . substr($u, 6, 1) .
substr($u, 5, 1) . substr($u, 4, 1) . substr($u, 3, 1) .
substr($u, 2, 1) . substr($u, 1, 1) . substr($u, 0, 1);
$nf = substr($b, 8, 1) . substr($b, 7, 1) . substr($b, 6, 1) .
substr($b, 5, 1) . substr($b, 4, 1) . substr($b, 3, 1) .
substr($b, 2, 1) . substr($b, 1, 1) . substr($b, 0, 1);
$nr = substr($l, 8, 1) . substr($l, 7, 1) . substr($l, 6, 1) .
substr($l, 5, 1) . substr($l, 4, 1) . substr($l, 3, 1) .
substr($l, 2, 1) . substr($l, 1, 1) . substr($l, 0, 1);
$nb = substr($f, 8, 1) . substr($f, 7, 1) . substr($f, 6, 1) .
substr($f, 5, 1) . substr($f, 4, 1) . substr($f, 3, 1) .
substr($f, 2, 1) . substr($f, 1, 1) . substr($f, 0, 1);
$nl = substr($r, 8, 1) . substr($r, 7, 1) . substr($r, 6, 1) .
substr($r, 5, 1) . substr($r, 4, 1) . substr($r, 3, 1) .
substr($r, 2, 1) . substr($r, 1, 1) . substr($r, 0, 1);
$nd = substr($d, 8, 1) . substr($d, 7, 1) . substr($d, 6, 1) .
substr($d, 5, 1) . substr($d, 4, 1) . substr($d, 3, 1) .
substr($d, 2, 1) . substr($d, 1, 1) . substr($d, 0, 1);
} elseif (($op == "(f)") || ($op == "z")) {
$nu = $l;
$nf = substr($f, 6, 1) . substr($f, 3, 1) . substr($f, 0, 1) .
substr($f, 7, 1) . substr($f, 4, 1) . substr($f, 1, 1) .
substr($f, 8, 1) . substr($f, 5, 1) . substr($f, 2, 1);
$nr = $u;
$nb = substr($b, 2, 1) . substr($b, 5, 1) . substr($b, 8, 1) .
substr($b, 1, 1) . substr($b, 4, 1) . substr($b, 7, 1) .
substr($b, 0, 1) . substr($b, 3, 1) . substr($b, 6, 1);
$nl = $d;
$nd = $r;
} elseif (($op == "(f')") || ($op == "z'")) {
$nu = $r;
$nf = substr($f, 2, 1) . substr($f, 5, 1) . substr($f, 8, 1) .
substr($f, 1, 1) . substr($f, 4, 1) . substr($f, 7, 1) .
substr($f, 0, 1) . substr($f, 3, 1) . substr($f, 6, 1);
$nr = $d;
$nb = substr($b, 6, 1) . substr($b, 3, 1) . substr($b, 0, 1) .
substr($b, 7, 1) . substr($b, 4, 1) . substr($b, 1, 1) .
substr($b, 8, 1) . substr($b, 5, 1) . substr($b, 2, 1);
$nl = $u;
$nd = $l;
} elseif (($op == "(f2)") || ($op == "z2")) {
$nu = $d;
$nf = substr($f, 8, 1) . substr($f, 7, 1) . substr($f, 6, 1) .
substr($f, 5, 1) . substr($f, 4, 1) . substr($f, 3, 1) .
substr($f, 2, 1) . substr($f, 1, 1) . substr($f, 0, 1);
$nr = $l;
$nb = substr($b, 8, 1) . substr($b, 7, 1) . substr($b, 6, 1) .
substr($b, 5, 1) . substr($b, 4, 1) . substr($b, 3, 1) .
substr($b, 2, 1) . substr($b, 1, 1) . substr($b, 0, 1);
$nl = $r;
$nd = $u;
} elseif (($op == "(r)") || ($op == "x")) {
$nu = $f;
$nf = substr($d, 8, 1) . substr($d, 7, 1) . substr($d, 6, 1) .
substr($d, 5, 1) . substr($d, 4, 1) . substr($d, 3, 1) .
substr($d, 2, 1) . substr($d, 1, 1) . substr($d, 0, 1);
$nr = substr($r, 6, 1) . substr($r, 3, 1) . substr($r, 0, 1) .
substr($r, 7, 1) . substr($r, 4, 1) . substr($r, 1, 1) .
substr($r, 8, 1) . substr($r, 5, 1) . substr($r, 2, 1);
$nb = $u;
$nl = substr($l, 2, 1) . substr($l, 5, 1) . substr($l, 8, 1) .
substr($l, 1, 1) . substr($l, 4, 1) . substr($l, 7, 1) .
substr($l, 0, 1) . substr($l, 3, 1) . substr($l, 6, 1);
$nd = substr($b, 8, 1) . substr($b, 7, 1) . substr($b, 6, 1) .
substr($b, 5, 1) . substr($b, 4, 1) . substr($b, 3, 1) .
substr($b, 2, 1) . substr($b, 1, 1) . substr($b, 0, 1);
} elseif (($op == "(r')") || ($op == "x'")) {
$nu = $b;
$nf = $u;
$nr = substr($r, 2, 1) . substr($r, 5, 1) . substr($r, 8, 1) .
substr($r, 1, 1) . substr($r, 4, 1) . substr($r, 7, 1) .
substr($r, 0, 1) . substr($r, 3, 1) . substr($r, 6, 1);
$nb = substr($d, 8, 1) . substr($d, 7, 1) . substr($d, 6, 1) .
substr($d, 5, 1) . substr($d, 4, 1) . substr($d, 3, 1) .
substr($d, 2, 1) . substr($d, 1, 1) . substr($d, 0, 1);
$nl = substr($l, 6, 1) . substr($l, 3, 1) . substr($l, 0, 1) .
substr($l, 7, 1) . substr($l, 4, 1) . substr($l, 1, 1) .
substr($l, 8, 1) . substr($l, 5, 1) . substr($l, 2, 1);
$nd = substr($f, 8, 1) . substr($f, 7, 1) . substr($f, 6, 1) .
substr($f, 5, 1) . substr($f, 4, 1) . substr($f, 3, 1) .
substr($f, 2, 1) . substr($f, 1, 1) . substr($f, 0, 1);
} elseif (($op == "(r2)") || ($op == "x2")) {
$nu = substr($d, 8, 1) . substr($d, 7, 1) . substr($d, 6, 1) .
substr($d, 5, 1) . substr($d, 4, 1) . substr($d, 3, 1) .
substr($d, 2, 1) . substr($d, 1, 1) . substr($d, 0, 1);
$nf = $b;
$nr = substr($r, 8, 1) . substr($r, 7, 1) . substr($r, 6, 1) .
substr($r, 5, 1) . substr($r, 4, 1) . substr($r, 3, 1) .
substr($r, 2, 1) . substr($r, 1, 1) . substr($r, 0, 1);
$nb = $f;
$nl = substr($l, 8, 1) . substr($l, 7, 1) . substr($l, 6, 1) .
substr($l, 5, 1) . substr($l, 4, 1) . substr($l, 3, 1) .
substr($l, 2, 1) . substr($l, 1, 1) . substr($l, 0, 1);
$nd = substr($u, 8, 1) . substr($u, 7, 1) . substr($u, 6, 1) .
substr($u, 5, 1) . substr($u, 4, 1) . substr($u, 3, 1) .
substr($u, 2, 1) . substr($u, 1, 1) . substr($u, 0, 1);
} elseif ($op == "Z01") { // PLL-01
$nu = substr($u, 0, 1) . substr($u, 7, 1) . substr($u, 2, 3) .
substr($u, 1, 1) . substr($u, 6, 1) . substr($u, 5, 1) . substr($u, 8, 1);
$nf = substr($f, 0, 1) . substr($r, 3, 1) . substr($f, 2, 7);
$nr = substr($r, 0, 3) . substr($b, 7, 1) . substr($r, 4, 5);
$nb = substr($b, 0, 7) . substr($f, 1, 1) . substr($b, 8, 1);
$nl = $l; $nd = $d;
} elseif ($op == "Z02") { // PLL-02
$nu = substr($u, 0, 1) . substr($u, 5, 1) . substr($u, 2, 3) .
substr($u, 7, 1) . substr($u, 6, 1) . substr($u, 1, 1) . substr($u, 8, 1);
$nf = substr($f, 0, 1) . substr($b, 7, 1) . substr($f, 2, 7);
$nr = substr($r, 0, 3) . substr($f, 1, 1) . substr($r, 4, 5);
$nb = substr($b, 0, 7) . substr($r, 3, 1) . substr($b, 8, 1);
$nl = $l; $nd = $d;
} elseif ($op == "Z03") { // PLL-03
$nu = substr($u, 0, 2) . substr($u, 6, 1) . substr($u, 3, 3) .
substr($u, 8, 1) . substr($u, 7, 1) . substr($u, 2, 1);
$nf = substr($r, 6, 1) . substr($f, 1, 1) . substr($r, 0, 1) . substr($f, 3, 6);
$nr = substr($l, 8, 1) . substr($r, 1, 5) . substr($b, 8, 1) . substr($r, 7, 2);
$nb = substr($b, 0, 8) . substr($f, 0, 1);
$nl = substr($l, 0, 8) . substr($f, 2, 1);
$nd = $d;
} elseif ($op == "Z04") { // PLL-04
$nu = substr($u, 0, 2) . substr($u, 8, 1) . substr($u, 3, 3) .
substr($u, 2, 1) . substr($u, 7, 1) . substr($u, 6, 1);
$nf = substr($b, 8, 1) . substr($f, 1, 1) . substr($l, 8, 1) . substr($f, 3, 6);
$nr = substr($f, 2, 1) . substr($r, 1, 5) . substr($f, 0, 1) . substr($r, 7, 2);
$nb = substr($b, 0, 8) . substr($r, 6, 1);
$nl = substr($l, 0, 8) . substr($r, 0, 1);
$nd = $d;
} elseif ($op == "Z05") { // Maneuver
$nu = substr($u, 0, 1) . substr($b, 7, 1) . substr($u, 2, 5) .
substr($f, 1, 1) . substr($u, 8, 1);
$nf = substr($f, 0, 1) . substr($u, 7, 1) . substr($f, 2, 7);
$nb = substr($b, 0, 7) . substr($u, 1, 1) . substr($b, 8, 1);
$nr = $r; $nl = $l; $nd = $d;
} elseif ($op == "Z06") { // F-R Maneuver
$nu = substr($u, 0, 5) . substr($r, 3, 1) . substr($u, 6, 1) .
substr($f, 1, 1) . substr($u, 8, 1);
$nf = substr($f, 0, 1) . substr($u, 7, 1) . substr($f, 2, 7);
$nr = substr($r, 0, 3) . substr($u, 5, 1) . substr($r, 4, 5);
$nb = $b; $nl = $l; $nd = $d;
} elseif ($op == "Z07") { // Double Maneuver
$nu = substr($u, 0, 1) . substr($b, 7, 1) . substr($u, 2, 1) .
substr($l, 5, 1) . substr($u, 4, 1) . substr($r, 3, 1) .
substr($u, 6, 1) . substr($f, 1, 1) . substr($u, 8, 1);
$nf = substr($f, 0, 1) . substr($u, 7, 1) . substr($f, 2, 7);
$nb = substr($b, 0, 7) . substr($u, 1, 1) . substr($b, 8, 1);
$nr = substr($r, 0, 3) . substr($u, 5, 1) . substr($r, 4, 5);
$nl = substr($l, 0, 5) . substr($u, 3, 1) . substr($l, 6, 3);
$nd = $d;
}
return $nu . $nf . $nr . $nl . $nb . $nd;
}
function scramble($mode) {
// echo "SCRAMBLE MODE : " . $mode . "
";
$m = strtoupper(substr($mode, 0, 3));
$n = substr($mode, 4);
if ($m == 'F2L') {
$ret = f2lscramble($n);
} elseif ($m == 'OLL') {
$ret = ollscramble($n);
} elseif ($m == 'PLL') {
$ret = pllscramble($n);
} elseif ($mode == 'NO') {
$ret = "";
} else {
$ret = scrambleauto($mode);
}
// echo "SCRAMBLE : " . $ret . "
";
return $ret;
}
function f2lscramble($n) {
$koho = array("Z01", "Z02", "Z03", "Z04", "Z05", "Z06", "Z07",
"(u)", "(u')", "(u2)");
$ret = "";
for ($i = 0; $i < 20; $i++) {
$ret .= $koho[rand(0, 9)];
if (rand(0, 1) == 1) $i++;
}
if (($n == '01') || ($n == '1') || ($n == 1)) {
$ret .= "F' U' F U";
} elseif (($n == '02') || ($n == '2') || ($n == 2)) {
$ret .= "R U R' U'";
} elseif (($n == '03') || ($n == '3') || ($n == 3)) {
$ret .= "R U' R'";
} elseif (($n == '04') || ($n == '4') || ($n == 4)) {
$ret .= "F' U F";
} elseif (($n == '05') || ($n == '5') || ($n == 5)) {
$ret .= "F' U' F U R U R' U'";
} elseif (($n == '06') || ($n == '6') || ($n == 6)) {
$ret .= "R U R' U' F' U' F U";
} elseif (($n == '07') || ($n == '7') || ($n == 7)) {
$ret .= "F' U' F U2 F' U F U'";
} elseif (($n == '08') || ($n == '8') || ($n == 8)) {
$ret .= "R U R' U2 R U' R' U";
} elseif (($n == '09') || ($n == '9') || ($n == 9)) {
$ret .= "R U' R' U F' U' F U'";
} elseif (($n == '10') || ($n == 10)) {
$ret .= "F' U F U' R U R' U";
} elseif (($n == '11') || ($n == 11)) {
$ret .= "F' U' F U2 F'U2FU'";
} elseif (($n == '12') || ($n == 12)) {
$ret .= "RUR'U2RU2R'U";
} elseif (($n == '13') || ($n == 13)) {
$ret .= "F'U'FUF'U2FU";
} elseif (($n == '14') || ($n == 14)) {
$ret .= "RUR'U'RU2R'U'";
} elseif (($n == '15') || ($n == 15)) {
$ret .= "RUR'U'RU'R'U2";
} elseif (($n == '16') || ($n == 16)) {
$ret .= "F'U'FUF'UFU2";
} elseif (($n == '17') || ($n == 17)) {
$ret .= "F'UFUF'U'FU'";
} elseif (($n == '18') || ($n == 18)) {
$ret .= "RU'R'U2F'U'F";
} elseif (($n == '19') || ($n == 19)) {
$ret .= "F'UFU'F'U2F";
} elseif (($n == '20') || ($n == 20)) {
$ret .= "RU2B'RBR'U'R'";
} elseif (($n == '21') || ($n == 21)) {
$ret .= "RU'R'UF'U2FU'";
} elseif (($n == '22') || ($n == 22)) {
$ret .= "RU'R'U'RUR'U";
} elseif (($n == '23') || ($n == 23)) {
$ret .= "F'UFU2RUR'";
} elseif (($n == '24') || ($n == 24)) {
$ret .= "RU'R'URU2R'";
} elseif (($n == '25') || ($n == 25)) {
$ret .= "F'U2LF'L'FUF";
} elseif (($n == '26') || ($n == 26)) {
$ret .= "F'UFU'RU2R'U";
} elseif (($n == '27') || ($n == 27)) {
$ret .= "R'FRF2U'F";
} elseif (($n == '28') || ($n == 28)) {
$ret .= "RU'R'F'U'FU'";
} elseif (($n == '29') || ($n == 29)) {
$ret .= "FR'F'R2UR'";
} elseif (($n == '30') || ($n == 30)) {
$ret .= "F'UFRUR'U";
} elseif (($n == '31') || ($n == 31)) {
$ret .= "F'UF'U2R'F2RU2F2";
} elseif (($n == '32') || ($n == 32)) {
$ret .= "R2U2R'U'RU'R'U2R'";
} elseif (($n == '33') || ($n == 33)) {
$ret .= "RU2RUR'URU2R2";
} elseif (($n == '34') || ($n == 34)) {
$ret .= "F2L'U'LUFU'F";
} elseif (($n == '35') || ($n == 35)) {
$ret .= "R2BUB'U'R'UR'";
} elseif (($n == '36') || ($n == 36)) {
$ret .= "F'U'FU2F'U'FU'";
} elseif (($n == '37') || ($n == 37)) {
$ret .= "RUR'U2RUR'U";
} elseif (($n == '38') || ($n == 38)) {
$ret .= "RU'R'UF'UFU'";
} elseif (($n == '39') || ($n == 39)) {
$ret .= "F'UFU'RU'R'U";
} elseif (($n == '40') || ($n == 40)) {
$ret .= "F2U2F2UF2UF2";
} elseif (($n == '41') || ($n == 41)) {
$ret .= "F'U2FRUR'";
} else {
$ret .= scrambleauto("auto");
}
return $ret;
}
function ollscramble($n) {
$koho = array("Z01", "Z02", "Z03", "Z04", "(u)", "(u')", "(u2)");
$ret = "";
for ($i = 0; $i < 15; $i++) {
$ret .= $koho[rand(0, 6)];
if (rand(0, 1) == 1) $i++;
}
if (($n == '01') || ($n == '1') || ($n == 1)) {
$ret .= "FR'F'RUR2B'R'BU'R'";
} elseif (($n == '02') || ($n == '2') || ($n == 2)) {
$ret .= "RUB'RBR2U'R'FRF'";
} elseif (($n == '03') || ($n == '3') || ($n == 3)) {
$ret .= "L'RB'LU2L'B'RB'R2L";
} elseif (($n == '04') || ($n == '4') || ($n == 4)) {
$ret .= "L'R2BR'BLU2L'BLR'";
} elseif (($n == '05') || ($n == '5') || ($n == 5)) {
$ret .= "L'B'RB'R'B2L";
} elseif (($n == '06') || ($n == '6') || ($n == 6)) {
$ret .= "RBL'BLB2R'";
} elseif (($n == '07') || ($n == '7') || ($n == 7)) {
$ret .= "RB2L'B'LB'R'";
} elseif (($n == '08') || ($n == '8') || ($n == 8)) {
$ret .= "L'B2RBR'BL";
} elseif (($n == '09') || ($n == '9') || ($n == 9)) {
$ret .= "FR'F'U'FRF'R'UR";
} elseif (($n == '10') || ($n == 10)) {
$ret .= "F'LFUF'L'FLU'L'";
} elseif (($n == '11') || ($n == 11)) {
$ret .= "L'RB'RB2R'BRB'R2L";
} elseif (($n == '12') || ($n == 12)) {
$ret .= "L'RBL'B2LBL'BR'L2";
} elseif (($n == '13') || ($n == 13)) {
$ret .= "F'U'FLF'L'ULFL'";
} elseif (($n == '14') || ($n == 14)) {
$ret .= "FUF'R'FRU'R'F'R";
} elseif (($n == '15') || ($n == 15)) {
$ret .= "RBR'ULU'L'RB'R'";
} elseif (($n == '16') || ($n == 16)) {
$ret .= "RBR'ULU'L'RB'R'";
} elseif (($n == '17') || ($n == 17)) {
$ret .= "BLUL'UB'U2B'RBR'";
} elseif (($n == '18') || ($n == 18)) {
$ret .= "LF'L'FU2FU'RU'R'F'";
} elseif (($n == '19') || ($n == 19)) {
$ret .= "R'F'U2F2URU'R'F'U2R";
} elseif (($n == '20') || ($n == 20)) {
$ret .= "SR'U'RURURU'R'S'";
} elseif (($n == '21') || ($n == 21)) {
$ret .= "RUR'URU'R'URU2R'";
} elseif (($n == '22') || ($n == 22)) {
$ret .= "R'U2R2UR2UR2U2R'";
} elseif (($n == '23') || ($n == 23)) {
$ret .= "R'U2R'D'RU2R'DR2";
} elseif (($n == '24') || ($n == 24)) {
$ret .= "B'R'F'RBR'FR";
} elseif (($n == '25') || ($n == 25)) {
$ret .= "R'F'RB'R'FRB";
} elseif (($n == '26') || ($n == 26)) {
$ret .= "RUR'URU2R'";
} elseif (($n == '27') || ($n == 27)) {
$ret .= "R'U'RU'R'U2R";
} elseif (($n == '28') || ($n == 28)) {
$ret .= "L'RB'R'LU2L'RB'R'L";
} elseif (($n == '29') || ($n == 29)) {
$ret .= "L'B2RBR2BLB'RB";
} elseif (($n == '30') || ($n == 30)) {
$ret .= "RB2L'B'L2B'R'BL'B'";
} elseif (($n == '31') || ($n == 31)) {
$ret .= "L'BLUL'U'B'UL";
} elseif (($n == '32') || ($n == 32)) {
$ret .= "RB'R'U'RUBU'R'";
} elseif (($n == '33') || ($n == 33)) {
$ret .= "FR'F'RURU'R'";
} elseif (($n == '34') || ($n == 34)) {
$ret .= "B'FRBR'F'U'R'UR";
} elseif (($n == '35') || ($n == 35)) {
$ret .= "RU2R'FR'FR2U2R'";
} elseif (($n == '36') || ($n == 36)) {
$ret .= "L'BLUL'U'B2UBL";
} elseif (($n == '37') || ($n == 37)) {
$ret .= "BUB'U'B'RBR'";
} elseif (($n == '38') || ($n == 38)) {
$ret .= "RB'R'U'RUB2U'B'R'";
} elseif (($n == '39') || ($n == 39)) {
$ret .= "LUF'U'L'ULFL'";
} elseif (($n == '40') || ($n == 40)) {
$ret .= "R'U'FURU'R'F'R";
} elseif (($n == '41') || ($n == 41)) {
$ret .= "RUBUB'U'R'U2RUR'";
} elseif (($n == '42') || ($n == 42)) {
$ret .= "L'U'B'U'BULU2L'U'L";
} elseif (($n == '43') || ($n == 43)) {
$ret .= "R'F'U'FUR";
} elseif (($n == '44') || ($n == 44)) {
$ret .= "RBUB'U'R'";
} elseif (($n == '45') || ($n == 45)) {
$ret .= "LUFU'F'L'";
} elseif (($n == '46') || ($n == 46)) {
$ret .= "R'U'FR'F'RUR";
} elseif (($n == '47') || ($n == 47)) {
$ret .= "R'U'F'UFU'F'UFR";
} elseif (($n == '48') || ($n == 48)) {
$ret .= "LUFU'F'UFU'F'L'";
} elseif (($n == '49') || ($n == 49)) {
$ret .= "L'BL2B'U2B'U2BL'";
} elseif (($n == '50') || ($n == 50)) {
$ret .= "RB'R2BU2BU2B'R";
} elseif (($n == '51') || ($n == 51)) {
$ret .= "R'F'U'FUF'U'FUR";
} elseif (($n == '52') || ($n == 52)) {
$ret .= "R'F'U'FU'RUR'UR";
} elseif (($n == '53') || ($n == 53)) {
$ret .= "L'B2RBR'B'RBR'BL";
} elseif (($n == '54') || ($n == 54)) {
$ret .= "RB2L'B'LBL'B'LB'R'";
} elseif (($n == '55') || ($n == 55)) {
$ret .= "B'RBU2R'U'RU'R2U2R";
} elseif (($n == '56') || ($n == 56)) {
$ret .= "F'RUBU'R'F2RB'R'F'";
} elseif (($n == '57') || ($n == 57)) {
$ret .= "FR'F'MFRF'M'";
} else {
$ret .= scrambleauto("auto");
}
return $ret;
}
function pllscramble($n) {
$koho = array("", "(u)", "(u')", "(u2)");
$ret = $koho[rand(0, 3)];
if (($n == '01') || ($n == '1') || ($n == 1)) {
$ret .= "R2U'S'U2SU'R2";
} elseif (($n == '02') || ($n == '2') || ($n == 2)) {
$ret .= "R2US'U2SUR2";
} elseif (($n == '03') || ($n == '3') || ($n == 3)) {
$ret .= "R2F2R'B'RF2R'BR'";
} elseif (($n == '04') || ($n == '4') || ($n == 4)) {
$ret .= "RB'RF2R'BRF2R2";
} elseif (($n == '05') || ($n == '5') || ($n == 5)) {
$ret .= "U'F2R'B'RBF'RF'B'RBR'";
} elseif (($n == '06') || ($n == '6') || ($n == 6)) {
$ret .= "B'F'U2BFLRU2L'R'";
} elseif (($n == '07') || ($n == '7') || ($n == 7)) {
$ret .= "BLFL'B'RLBR'F'RB'R'L'";
} elseif (($n == '08') || ($n == '8') || ($n == 8)) {
$ret .= "B2DL2U'L2B2D'R2UR2U'";
} elseif (($n == '09') || ($n == '9') || ($n == 9)) {
$ret .= "R'B'R'BRB2DBD'BURU'R";
} elseif (($n == '10') || ($n == 10)) {
$ret .= "R2B'RD2L'FLD2RFRBR'F'";
} elseif (($n == '11') || ($n == 11)) {
$ret .= "F2LFUF'U'F'UL'F'LU'L'F'";
} elseif (($n == '12') || ($n == 12)) {
$ret .= "F2R'F'U'FUFU'RFR'URF";
} elseif (($n == '13') || ($n == 13)) {
$ret .= "R2D'R'DR'B2LU'L'B2";
} elseif (($n == '14') || ($n == 14)) {
$ret .= "R2DRD'RF2L'ULF2";
} elseif (($n == '15') || ($n == 15)) {
$ret .= "F2U'L2D'L2ULDL'F2RU'R'";
} elseif (($n == '16') || ($n == 16)) {
$ret .= "R'L'U2RLU2BU'FU2B'UF'";
} elseif (($n == '17') || ($n == 17)) {
$ret .= "U2BU'FU2B'UF'R'L'U2RL";
} elseif (($n == '18') || ($n == 18)) {
$ret .= "U2B'UF'U2BU'FRLU2R'L'";
} elseif (($n == '19') || ($n == 19)) {
$ret .= "RLU2R'L'U2F'UB'U2FU'B";
} elseif (($n == '20') || ($n == 20)) {
$ret .= "UR'UL'U2RU'LR'UL'U2RU'L";
} elseif (($n == '21') || ($n == 21)) {
$ret .= "U'RU'LU2R'UL'RU'LU2R'UL'";
} else {
$ret .= scrambleauto("auto");
}
return $ret;
}
function scrambleauto($mode) {
// echo "Now Scramble...";
$scramble = "";
$men = "FURDBL";
$fmen = "URDL";
$umen = "FRLB";
$rmen = "FUBD";
$dir = "+-2";
$tesu = 0;
$randir = substr($dir, rand(0, 2), 1);
$last = substr($men, rand(0, 5), 1);
if ($randir == '-') $scramble .= "'";
if ($randir == '2') $scramble .= "2";
$scramble = $last . " ";
$tesu++;
if ($mode < 1) $auto = "auto";
$auto = ($mode == "auto") ? 1 : 0;
if ($auto == 1) $mode = 30;
for ($i = 1; $i < $mode; $i++) {
if (($last == "F") || ($last == "B")) $men = $fmen;
if (($last == "U") || ($last == "D")) $men = $umen;
if (($last == "R") || ($last == "L")) $men = $rmen;
$last = substr($men, rand(0, 3), 1);
$scramble .= $last;
$tesu++;
$randir = substr($dir, rand(0, 2), 1);
if ($randir == '-') $scramble .= "'";
if ($randir == '2') $scramble .= "2";
if (($i > 10) && ($auto)) {
$skip = rand(0, 1);
if ($skip) $i++;
}
$scramble .= " ";
}
// echo " (" . $tesu . ")
";
return $scramble . mukiscramble();
}
function mukiscramble() {
//$muki = array("", "(u)", "(u')" , "(u2)",
// "(r)", "(r)(u)", "(r)(u2)", "(r)(u')",
// "(f)", "(f)(u)", "(f)(u')", "(f)(u2)",
// "(f')", "(f')(u)", "(f')(u')", "(f')(u2)",
// "(r')", "(r')(u)", "(r')(u')", "(r')(u2)",
// "(r2)", "(r2)(u)", "(r2)(u')", "(r2)(u2)");
$muki = array("", "y ", "y' " , "y2 ",
"x ", "x y ", "x y2 ", "x y' )",
"z ", "z y ", "z y' ", "z y2 ",
"z' ", "z' y ", "z' y' ", "z' y2 ",
"x' ", "x' y ", "x' y' ", "x' y2 ",
"x2 ", "x2 y ", "x2 y' ", "x2 y2 ");
return $muki[rand(0, 23)];
}
function getparam($param, $default = "") {
$value = $default;
if ($_POST[$param]) $value = $_POST[$param];
if ($_GET[$param]) $value = $_GET[$param];
return safeStripSlashes(trim($value));
}
function safeStripSlashes($v) {
if (is_array($v)) {
return array_map('safeStripSlashes', $v);
} else {
if (get_magic_quotes_gpc()) {
$v = stripslashes($v);
}
return $v;
}
}
?>
Virtual WebCube ver2.00
Virtual WebCube ver2.00