### changeset 101:1f6c095453ae

Removed extra whitespace
author Sigurd Meldgaard Fri, 10 Jul 2009 11:01:59 +0200 b861d026f3df 7f816d773350 examples/millionaires.py 1 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
```--- a/examples/millionaires.py	Fri Jul 10 11:01:12 2009 +0200
+++ b/examples/millionaires.py	Fri Jul 10 11:01:59 2009 +0200
@@ -35,7 +35,7 @@
# Input player networths.
networths = runtime.input(runtime.players.keys(), Zp, input)

-    # Create a list of tuples of identity and corresponding networths.
+    # Create a list of tuples of identity and corresponding networths.
ls = zip(ids, networths)

richest, max = millionaries(runtime, ls)
@@ -45,11 +45,11 @@
def not_nice_millionaries(runtime, ls):
"""Computes the richest millionaire given a list of
pairs of identity and networth.
-
+
Returns a pair of identity and networth of the richest millionaire.
"""

-    # Declare temporary variables.
+    # Declare temporary variables.
# *richest* contains the identity of the currently richest player.
# *max* contains the networth of the currently richest player.
richest = Share(runtime, Zp, Zp(0))
@@ -60,7 +60,7 @@
b = networth >= current_max
max     = b * networth + (1 - b) * max
richest = b * id + (1 - b) * richest
-
+
return richest, max

# ===========================================================================
@@ -71,7 +71,7 @@
def maximum(current_id, current_max, id, networth):
"""Computes the maximum of current_max and networth.

-    Returns the pair corresponding to the maximum value of
+    Returns the pair corresponding to the maximum value of
current_max and networth.
"""
identity = current_id
@@ -84,11 +84,11 @@
def millionaries(runtime, ls):
"""Computes the richest millionaire given a list of
pairs of identity and networth.
-
+
Returns a pair of identity and networth of the richest millionaire.
"""

-    # Declare temporary variables.
+    # Declare temporary variables.
# *richest* contains the identity of the currently richest player.
# *max* contains the networth of the currently richest player.
richest = Share(runtime, Zp, Zp(0))
@@ -116,7 +116,7 @@

def output_to_richest(runtime, richest, max):
"""Everyone learns the identity of the richest, but not his networth.
-
+
This corresponds to Figur 4(A) in the paper
"A Domain-Specific Programming Language for Secure Multiparty Computation"
by Janus Dam Nielsen and Michael I. Schwartzbach.
@@ -134,7 +134,7 @@

def output_status(runtime, richest, max):
"""Everyone learns their own status, but not the others.
-
+
This corresponds to Figur 4(B) in the paper
"A Domain-Specific Programming Language for Secure Multiparty Computation"
by Janus Dam Nielsen and Michael I. Schwartzbach.
@@ -146,7 +146,7 @@

secret_ids = runtime.input(runtime.players.keys(), Zp, runtime.id)
ids = runtime.players.keys()
-
+
ls = zip(ids, secret_ids)

for id, secret_id in ls:
@@ -179,7 +179,7 @@
# Input player networths.
networths = runtime.input(runtime.players.keys(), Zp, input)

-    # Create a list of tuples of identity and corresponding networths.
+    # Create a list of tuples of identity and corresponding networths.
ls = zip(ids, networths)

richest, max = millionaries(runtime, ls)```