[MN-dev] [mndiff]: r174 - trunk/ffvotetov/ffvotetov.c
michael
subversion at mplayerhq.hu
Thu Dec 17 03:44:59 CET 2009
Author: michael
Date: Thu Dec 17 03:44:59 2009
New Revision: 174
Log:
Add a borda count based on 10points in addition to a candidate based one.
(for future votes)
Modified:
trunk/ffvotetov/ffvotetov.c
Modified: trunk/ffvotetov/ffvotetov.c
==============================================================================
--- trunk/ffvotetov/ffvotetov.c Thu Dec 17 02:03:52 2009 (r173)
+++ trunk/ffvotetov/ffvotetov.c Thu Dec 17 03:44:59 2009 (r174)
@@ -206,7 +206,7 @@ void add_vote(int vote[CANDIDATES_MAX]){
int j,k;
for(j=0; j<CANDIDATES_MAX; j++){
- if(vote[j]){
+ if(vote[j]>0 && vote[j] <=10){
sums[j] -= vote[j];
subs[j] ++;
}
@@ -252,12 +252,10 @@ int main(){
add_vote(vote);
}
add_vote(vote);
- for(j=0; j<canditate_count; j++)
- sums[j] += subs[j]*canditate_count;
printf("Candidates:\n");
for(cand_idx=0; cand_idx<canditate_count; cand_idx++)
- printf(" Borda:%3d \"%s\"\n", sums[cand_idx], canditates[cand_idx]);
+ printf(" Borda:%3d %3d\"%s\"\n", sums[cand_idx] + subs[cand_idx]*canditate_count, sums[cand_idx] + 10*subs[cand_idx], canditates[cand_idx]);
printf("Condorcet methods based on votes:\n");
do_condercets();
More information about the Mndiff-dev
mailing list