} } else { if ($stb->isValid()) { echo '<h2>Not finished yet</h2>'; if (isset($turns)) { echo '<p>Rolls: '; $count = 0; foreach ($turns as $t) { if ($count != 0) { echo ', '; } echo $t; $count++; } echo '</p>'; echo '<p>From these rolls there are ' . $stb->countValidChildren() . ' valid solutions but no way to shut the box...yet!'; } } else { echo '<h2>Failed</h2>'; if (isset($turns)) { echo '<p>Rolls: '; $count = 0; foreach ($turns as $t) { if ($count != 0) { echo ', '; } echo $t; $count++; } echo '</p>'; }