From c5e0494dd74402b7891eace0155a14d5bd7fbebd Mon Sep 17 00:00:00 2001 From: Daniel Tartavel Date: Fri, 23 Sep 2022 15:33:28 +0200 Subject: [PATCH] test --- methods/schulzeResults.php | 24 +++++++++++++++++++++--- test.php | 4 ++++ 2 files changed, 25 insertions(+), 3 deletions(-) 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(); + + ?>