Example #1
0
function vectorTest($rec)
{
    $norm = getEuclideanNorm($rec->sol);
    echo "" . $rec->dim . "|" . $norm . "|" . $rec->name . "|" . $rec->sol . "|" . "|" . "|" . "|\n";
}
Example #2
0
function submit($vector, $name, $email, $algorithm, $hardware, $runtime, $notes)
{
    if (!vectorCorrectFormat($vector)) {
        printError("The vector has an incorrect format.");
        return 1;
    }
    $name = str_replace(' and ', ', ', $name);
    $dim = getVectorDimension($vector);
    $norm = getEuclideanNorm($vector);
    $vector = normalizeVector($vector);
    $message = "<p>You have submitted: <br />\nvector='" . htmlspecialchars($vector) . "'<br />\ndim='" . htmlspecialchars($dim) . "'<br />\nname='" . htmlspecialchars($name) . "'<br />\nemail='" . htmlspecialchars($email) . "'<br />\nalgorithm='" . htmlspecialchars($algorithm) . "'<br />\nhardware='" . htmlspecialchars($hardware) . "'<br />\nruntime='" . htmlspecialchars($runtime) . "'<br />\nnorm='" . htmlspecialchars($norm) . "'<br />\nnotes='" . htmlspecialchars($notes) . "'</p>";
    echo $message;
    /* printStep("Testing if vector " . htmlspecialchars($vector) . " is formatted correctly...");
    	
    	printStep("Testing if vector " . htmlspecialchars($vector) . " is the correct solution...");
    	$result = exec("includes/verify --dim " . escapeshellcmd($dim) . " --solution '" . $vector . "'");
    	//echo ("includes/verify --dim " . escapeshellcmd($dim) . " --solution '" . $vector . "'");
    
    
    	if (strcmp($result, "the vector is too long") == 0) {
    		printError("The vector is too long. The sub process returned: " . htmlspecialchars($result));
    		return 1;
    	}
    	
    	if (strcmp($result, "the vector is in the lattice") != 0) {
        printError("The vector is not the correct solution. The sub process returned: " . htmlspecialchars($result));
        return 1;
      }
    	
      $best = vectorIsTheBestInThisDim($dim, $norm);
      
      if (!$best) {
        printError("The vector is a correct solution, but a better vector has already been submitted");
        return 1;
      }
    
    */
    printOK("Success! You have successfully submitted a correct solution!");
    enterInHallOfFame($norm, $vector, $dim, $name, $email, $algorithm, $hardware, $runtime, $notes);
    //mail("*****@*****.**", "[LatticeChallenge] New Solution", $message);
    ?>
<script type="text/css" href="style/colour.css">
     $( '#cell' ).css('background', 'red');
</script>
<?php 
}