MRB
Bir sitede ingiltereye ait bizdede uygulanan dhondt seçim sistemine göre
bir kod yazılmış ancak sandalye sayısı( millet vekili sayısı) 15 ile sınırlı
bu sayıyı nasıl eğiştirebiliriz . Verilen kod:
for ($round = 0; $round <= $total_rounds; $round++) {
for ($party = 0; $party < $total_parties; $party++) {
if ($round == 0) { $quotient[$round][$party] = $partyvote[$party]; } else { $quotient[$round][$party] = $partyvote[$party] / ($seat[$round - 1][$party] +1); }
}
$max[] = max($quotient[$round]);
for ($party = 0; $party < $total_parties; $party++) {
if ($round == 0) { $seat[$round][$party] = 0; } elseif ($quotient[$round][$party] == $max[$round]) { $seat[$round][$party] = $seat[$round - 1][$party] + 1; } else { $seat[$round][$party] = $seat[$round - 1][$party]; }
}
}
partilerin alabileceği oyları sırasıyla yazıyorum D'Hondt yöntemi ile hesaplama yapmak istiyorum bu kodu nasıl revize edebilirim.
kodun bulunduğu internet sitesi :http://www.moonwise.co.uk/dhondt.php
Bir sitede ingiltereye ait bizdede uygulanan dhondt seçim sistemine göre
bir kod yazılmış ancak sandalye sayısı( millet vekili sayısı) 15 ile sınırlı
bu sayıyı nasıl eğiştirebiliriz . Verilen kod:
for ($round = 0; $round <= $total_rounds; $round++) {
for ($party = 0; $party < $total_parties; $party++) {
if ($round == 0) { $quotient[$round][$party] = $partyvote[$party]; } else { $quotient[$round][$party] = $partyvote[$party] / ($seat[$round - 1][$party] +1); }
}
$max[] = max($quotient[$round]);
for ($party = 0; $party < $total_parties; $party++) {
if ($round == 0) { $seat[$round][$party] = 0; } elseif ($quotient[$round][$party] == $max[$round]) { $seat[$round][$party] = $seat[$round - 1][$party] + 1; } else { $seat[$round][$party] = $seat[$round - 1][$party]; }
}
}
partilerin alabileceği oyları sırasıyla yazıyorum D'Hondt yöntemi ile hesaplama yapmak istiyorum bu kodu nasıl revize edebilirim.
kodun bulunduğu internet sitesi :http://www.moonwise.co.uk/dhondt.php
