Ejemplo n.º 1
0
function lanes($c, $s, $conf)
{
    //acceptes the same conditions,
    //$c contains 5 champions
    //$s is an array containing 10 spells
    $arrangement = array(0, 0, 0, 0, 0);
    for ($i = 0; $i < 5; $i++) {
        # set the arrangement by calculating the probability of each champion
        $arrangement[$i] = rLane(probability($c[$i], $s[2 * $i], $s[2 * $i + 1]), false);
        $conf[$i] = confidence(probability($c[$i], $s[2 * $i], $s[2 * $i + 1]));
    }
    return array_merge(distTeam($arrangement), $conf);
}
Ejemplo n.º 2
0
 $sql .= ", SUM(CASE WHEN restricted != 1 THEN 1 ELSE 0 END) AS not_restricted";
 $sql .= ", SUM(CASE WHEN allowed > 0 THEN 1 ELSE 0 END) AS allowed";
 $sql .= ", SUM(CASE WHEN allowed <= 0 THEN 1 ELSE 0 END) AS not_allowed";
 $sql .= ", MAX(used) AS used";
 $sql .= ", MAX(modified) AS modified";
 $sql .= ", SUM(updates) AS updates";
 $sql .= " FROM xprivacy";
 $sql .= " WHERE package_name = '" . $db->real_escape_string($package_name) . "'";
 $sql .= " GROUP BY restriction, method";
 $sql .= " ORDER BY restriction, method";
 $result = $db->query($sql);
 if ($result) {
     while ($row = $result->fetch_object()) {
         $count++;
         $votes += $row->restricted + $row->not_restricted;
         $ci = confidence($row->restricted, $row->not_restricted);
         $diff = $row->restricted / ($row->restricted + $row->not_restricted);
         $restrict = $ci < $max_confidence && $diff > $min_diff && $row->allowed <= $row->not_allowed;
         echo '<tr style="';
         if (!empty($row->method)) {
             echo 'display: none;';
         }
         if ($row->used) {
             echo 'font-weight: bold;';
         }
         if ($restrict) {
             echo 'background: lightgray;';
         }
         echo '"';
         if (!empty($row->method)) {
             echo ' class="details"';