"Hoogh, S.J.A. de" <[EMAIL PROTECTED]> writes:

Hi Sebastiaan

I've looked at your code, and I don't understand the final part, the
one which is supposed to calculate the sorted order of the
millionaires:

        # We can establish the correct order of Millionaires 2 and 3.
                comparison = [5]
                if m1_gt_m2 and m1_gt_m3 and m1_gt_m4 and m1_gt_m5:
                        comparison = [1]
                elif not m1_gt_m2 and m2_gt_m3 and m2_gt_m4 and m2_gt_m5:
                        comparison = [2]
                elif not m1_gt_m3 and not m2_gt_m3 and m3_gt_m4 and m3_gt_m5:
                        comparison = [3]
                elif not m1_gt_m4 and not m2_gt_m4 and not m3_gt_m4 and 
m4_gt_m5:
                        comparison = [4]

The original code is here:

  http://hg.viff.dk/viff/file/153c24a4a6c5/apps/millionaires.py#l115

and it works by ordering the numbers 1, 2, 3 by hand in the comparison
list: it first checks to see if 2 and 3 should be ordered [3, 2] or
[2, 3] and it then puts the number 1 into this list in the right spot.
The final output is thus something like this:

  I am Millionaire 1 and I am worth 193 millions.
  From poorest to richest:
    Millionaire 3
    Millionaire 2
    Millionaire 1 (193 millions)

and I can understand why you don't get this output with your code.

-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multi-Party Computation) to Python. See: http://viff.dk/.
_______________________________________________
viff-devel mailing list (http://viff.dk/)
viff-devel@viff.dk
http://lists.viff.dk/listinfo.cgi/viff-devel-viff.dk

Reply via email to