} else { $stb = new ShutTheBox(); } //Get the turns, iterate through them and make the moves if (isset($_POST['dice']) && is_array($_POST['dice'])) { $turns = $_POST['dice']; //print_r($turns); foreach ($turns as $t) { $stb->takeTurn($t); } } //If the root is marked as successful then a root to success has been found if ($stb->getSuccess()) { echo '<h2>Complete</h2>'; echo '<p>Here are the moves you could have made:</p><hr>'; $next = $stb->next(); $min = $stb->min; $max = $stb->max; //Display the beginning state: echo '<div class="tiles">'; for ($i = $min; $i <= $max; $i++) { echo '<div class="tile available"><p>'; echo "{$i}</p></div>"; } echo '</div>'; while (!is_null($next)) { $to_drop = $next->turn->values; $length = sizeof($to_drop); echo '<p class="centre">Rolled a '; echo $next->turn->getDiceRoll(); echo ': drop the ';