Editing Maemo.org Coding Competition 2012

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.

Warning: This page is 36 kilobytes long; some browsers may have problems editing pages approaching or longer than 32kb. Please consider breaking the page into smaller sections.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1,207: Line 1,207:
* For determining the third place, OpenSTV is run for three seats. The newly added/elected participant takes the third place.
* For determining the third place, OpenSTV is run for three seats. The newly added/elected participant takes the third place.
* This process is repeated until the number of seats reaches n-1 with n being the number of participants. The remaining participant not being added or elected yet takes the last place.
* This process is repeated until the number of seats reaches n-1 with n being the number of participants. The remaining participant not being added or elected yet takes the last place.
-
 
-
For automating this counting process the following script is used
 
-
<pre>
 
-
election=$1
 
-
 
-
tail -n 1 $election | sed 's/"//g'
 
-
 
-
>/tmp/result
 
-
for i in $(seq $(expr $(head -c 2 $election) - 1))
 
-
do
 
-
  openstv-run-election -r CsvReport -s $i FTSTV $election \
 
-
    | awk -F, '/Elected/ { print $1 }' \
 
-
    | while read w
 
-
        do if ! grep -q "$w" /tmp/result
 
-
          then
 
-
            echo $w >> /tmp/result
 
-
            break
 
-
          fi
 
-
        done
 
-
done
 
-
awk 'BEGIN { i = 1; } { print i, $0; i++; }' /tmp/result | sed 's/"//g'
 
-
</pre>
 
-
This script should be saved to a file named "results" and can be called as follows:
 
-
<pre>
 
-
for i in *.blt; do sh results $i; done
 
-
</pre>
 
-
Assuming the script + openstv-run-election are in the same directory as the result files (the *.blt files) for all categories and the current directory is this directory, this way of calling the script will perform the counting for all categories.
 
-
The '''only''' thing that may be changed in the above script is the passage "openstv-run-election" for adding a proper path to the actual location of the OpenSTV executable, e.g., to point to "/usr/bin/openstv-run-election". Aside from this exception the script must not be changed at all.
 
-
 
-
However it is still possible to also do the vote counting manually using the described process. Vote counting process, OpenSTV version used, and counting script are all publicly available so everyone can perform the voting and verify the final official results.
 
== App Developer Resources ==
== App Developer Resources ==

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)