$num) { $tile_data[$num] = array('correct_pos' => $pos, 'type' => 'letter', 'letter' => $ltr); $pos++; } foreach ($evens as $num) { $tile_data[$num] = array('correct_pos' => $pos, 'type' => 'distractor'); $pos++; } // Create shuffled positions $positions = array(); for ($i = 0; $i < 35; $i++) { $positions[] = $i; } shuffle($positions); // Count inversions for solvability $inv = 0; for ($i = 0; $i < 35; $i++) { for ($j = $i + 1; $j < 35; $j++) { if ($positions[$i] > $positions[$j]) { $inv++; } } } if ($inv % 2 == 1) { $t = $positions[0]; $positions[0] = $positions[1]; $positions[1] = $t; } // Build current state $current = array(); for ($i = 0; $i < 36; $i++) { if ($i < 35) { $current[] = $positions[$i]; } else { $current[] = -1; } } ?> Cipher Puzzle

CIPHER PUZZLE

= 0) { echo '
'.$current[$i].'
'; } else { echo '
'; } } ?>
Correct: 0/35

CIPHER KEY

$num) { echo '
'.$ltr.'
'.$num.'
'; } ?>

HOW TO PLAY