1
0
This commit is contained in:
Daniel Tartavel 2022-09-23 15:33:28 +02:00
parent f5c2f4309f
commit c5e0494dd7
2 changed files with 25 additions and 3 deletions

View File

@ -6,11 +6,12 @@ class schulze
public int $ncandidats; public int $ncandidats;
public array $nvotes; public array $nvotes;
$v = array( public $v = array(
array(5, 1, 3, 2, 4), array(5, 1, 3, 2, 4),
array(1, 5, 2, 4, 3), array(1, 5, 2, 4, 3),
array(5, 3, 2, 4, 1), 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() function matrix()
@ -29,8 +30,25 @@ class schulze
function test($v) function test($v)
{ {
$w = array();
asort($v); 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() function result()

View File

@ -1,4 +1,8 @@
<?php <?php
require "methods/schulzeResults.php";
$vote = new schulze; $vote = new schulze;
$vote->test(); $vote->test();
?> ?>