test
This commit is contained in:
parent
f5c2f4309f
commit
c5e0494dd7
@ -6,11 +6,12 @@ class schulze
|
||||
public int $ncandidats;
|
||||
public array $nvotes;
|
||||
|
||||
$v = array(
|
||||
public $v = array(
|
||||
array(5, 1, 3, 2, 4),
|
||||
array(1, 5, 2, 4, 3),
|
||||
array(5, 3, 2, 4, 1),
|
||||
array(5, 1, 3, 2, 4)
|
||||
array(5, 1, 3, 2, 4),
|
||||
array(5, 3, 2, 4, 1),
|
||||
);
|
||||
|
||||
function matrix()
|
||||
@ -29,8 +30,25 @@ class schulze
|
||||
|
||||
function test($v)
|
||||
{
|
||||
$w = array();
|
||||
|
||||
asort($v);
|
||||
var_dump($v);
|
||||
print_r($v);
|
||||
for($i=0;isset($v);$v++)
|
||||
{
|
||||
if ($i == 0)
|
||||
{
|
||||
$w[] = $v[$i];
|
||||
}
|
||||
if ($v[$i] == $v[$i+1])
|
||||
{
|
||||
$w[$i] += 1;
|
||||
}else
|
||||
{
|
||||
$w[] = $v[$i+1];
|
||||
}
|
||||
print_r($w);
|
||||
}
|
||||
}
|
||||
|
||||
function result()
|
||||
|
4
test.php
4
test.php
@ -1,4 +1,8 @@
|
||||
<?php
|
||||
require "methods/schulzeResults.php";
|
||||
|
||||
$vote = new schulze;
|
||||
$vote->test();
|
||||
|
||||
|
||||
?>
|
||||
|
Reference in New Issue
Block a user