diff --git a/methods/schulzeResults.php b/methods/schulzeResults.php index 873c6ea..ad91315 100644 --- a/methods/schulzeResults.php +++ b/methods/schulzeResults.php @@ -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() diff --git a/test.php b/test.php index af51899..0803b00 100644 --- a/test.php +++ b/test.php @@ -1,4 +1,8 @@ test(); + + ?>