viff

changeset 825:73f6984432b5

Renamed variables to reflect ">=", not ">".
author Martin Geisler <mg@daimi.au.dk>
date Sun, 13 Jul 2008 15:16:00 +0200
parents b1438b77e4d6
children 420569d71d4d
files apps/millionaires.py
diffstat 1 files changed, 13 insertions(+), 13 deletions(-) [+]
line diff
     1.1 --- a/apps/millionaires.py	Sat Jul 12 20:15:48 2008 +0200
     1.2 +++ b/apps/millionaires.py	Sun Jul 13 15:16:00 2008 +0200
     1.3 @@ -72,19 +72,19 @@
     1.4          # compare them. We compare the worth of the first millionaire
     1.5          # with the two others, and compare those two millionaires with
     1.6          # each other.
     1.7 -        m1_gt_m2 = m1 >= m2
     1.8 -        m1_gt_m3 = m1 >= m3
     1.9 -        m2_gt_m3 = m2 >= m3
    1.10 +        m1_ge_m2 = m1 >= m2
    1.11 +        m1_ge_m3 = m1 >= m3
    1.12 +        m2_ge_m3 = m2 >= m3
    1.13  
    1.14          # The results are secret shared, so we must open them before
    1.15          # we can do anything usefull with them.
    1.16 -        open_m1_gt_m2 = runtime.open(m1_gt_m2)
    1.17 -        open_m1_gt_m3 = runtime.open(m1_gt_m3)
    1.18 -        open_m2_gt_m3 = runtime.open(m2_gt_m3)
    1.19 +        open_m1_ge_m2 = runtime.open(m1_ge_m2)
    1.20 +        open_m1_ge_m3 = runtime.open(m1_ge_m3)
    1.21 +        open_m2_ge_m3 = runtime.open(m2_ge_m3)
    1.22  
    1.23          # We will now gather the results and call the
    1.24          # self.results_ready method when they have all been received.
    1.25 -        results = gather_shares([open_m1_gt_m2, open_m1_gt_m3, open_m2_gt_m3])
    1.26 +        results = gather_shares([open_m1_ge_m2, open_m1_ge_m3, open_m2_ge_m3])
    1.27          results.addCallback(self.results_ready)
    1.28  
    1.29          # We can add more callbacks to the callback chain in results.
    1.30 @@ -102,21 +102,21 @@
    1.31          # Shares. That makes it very easy to work on them.
    1.32  
    1.33          # Let us start by unpacking the list.
    1.34 -        m1_gt_m2 = results[0]
    1.35 -        m1_gt_m3 = results[1]
    1.36 -        m2_gt_m3 = results[2]
    1.37 +        m1_ge_m2 = results[0]
    1.38 +        m1_ge_m3 = results[1]
    1.39 +        m2_ge_m3 = results[2]
    1.40  
    1.41          # We can establish the correct order of Millionaires 2 and 3.
    1.42 -        if m2_gt_m3:
    1.43 +        if m2_ge_m3:
    1.44              comparison = [3, 2]
    1.45          else:
    1.46              comparison = [2, 3]
    1.47  
    1.48          # We only have to insert Millionaire 1 in the correct spot.
    1.49 -        if m1_gt_m2 and m1_gt_m3:
    1.50 +        if m1_ge_m2 and m1_ge_m3:
    1.51              # Millionaire 1 is largest.
    1.52              comparison = comparison + [1]
    1.53 -        elif not m1_gt_m2 and not m1_gt_m3:
    1.54 +        elif not m1_ge_m2 and not m1_ge_m3:
    1.55              # Millionaire 1 is smallest.
    1.56              comparison = [1] + comparison
    1.57          else: