function run()
 {
     if (checkSuccess($group, $colRules, $noOfRows, $noOfCols)) {
         echo "<div style=\"float:right\">Solution Found<br />";
         $endTime = microtime_float();
         echo "END:" . $endTime . "<br />";
         echo "START:" . $startTime . "<br />";
         echo " - Time taked " . ($endTime - $startTime) . "</div>";
         exit;
     }
 }
Ejemplo n.º 2
0
            $return = array_merge($return, pc_permute($newitems, $newperms));
        }
    }
    return $return;
}
$keys = array();
for ($i = 0; $i < count($possibleRows); $i++) {
    array_push($keys, array_keys($possibleRows[$i]));
}
$keySet = combos($keys);
for ($i = 0; $i < count($keySet); $i++) {
    $row = array();
    for ($j = 0; $j < $NO_OF_ROWS; $j++) {
        array_push($row, $possibleRows[$j][$keySet[$i][$j]]);
    }
    if (checkSuccess($row, $colRules, $NO_OF_ROWS, $NO_OF_COLS)) {
        echo "<div style=\"float:right\">Solution Found<br />";
        $endTime = microtime_float();
        echo "END:" . $endTime . "<br />";
        echo "START:" . $startTime . "<br />";
        echo " - Time taked " . ($endTime - $startTime) . "</div>";
        exit;
    }
}
echo "<div style=\"float:right\">No Solution Found</div>";
exit;
function checkSuccess($set, $colRules, $rowCount, $columnCount)
{
    $output = array();
    $match = 0;
    for ($i = 0, $index = 0; $i < $columnCount; $i++) {