aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/consensus/consensus-simulation.py.in12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/consensus/consensus-simulation.py.in b/src/consensus/consensus-simulation.py.in
index 71a91302e..fbad9f678 100644
--- a/src/consensus/consensus-simulation.py.in
+++ b/src/consensus/consensus-simulation.py.in
@@ -21,7 +21,7 @@ from __future__ import absolute_import
21from __future__ import print_function 21from __future__ import print_function
22import argparse 22import argparse
23import random 23import random
24from math import ceil,log,floor 24from math import ceil, log, floor
25 25
26 26
27def bsc(n): 27def bsc(n):
@@ -57,7 +57,7 @@ def simulate(k, n, verbose):
57 arc = 1 57 arc = 1
58 while arc <= largest_arc: 58 while arc <= largest_arc:
59 if verbose: 59 if verbose:
60 prin( "-- subround --") 60 print("-- subround --")
61 new_info = [x for x in info] 61 new_info = [x for x in info]
62 for peer_physical in xrange(n): 62 for peer_physical in xrange(n):
63 peer_logical = peers[peer_physical] 63 peer_logical = peers[peer_physical]
@@ -71,7 +71,7 @@ def simulate(k, n, verbose):
71 if peer_logical & arc == 0: 71 if peer_logical & arc == 0:
72 # we are outgoing 72 # we are outgoing
73 if verbose: 73 if verbose:
74 print peer_physical, "connects to", partner_physical 74 print(peer_physical, "connects to", partner_physical)
75 peer_type = "outgoing" 75 peer_type = "outgoing"
76 if peer_logical < num_ghosts: 76 if peer_logical < num_ghosts:
77 # we have a ghost, check if the peer who connects 77 # we have a ghost, check if the peer who connects
@@ -86,7 +86,7 @@ def simulate(k, n, verbose):
86 if verbose > 1: 86 if verbose > 1:
87 print("type of", str(peer_physical) + ":", peer_type) 87 print("type of", str(peer_physical) + ":", peer_type)
88 info = new_info 88 info = new_info
89 arc = arc << 1; 89 arc = arc << 1
90 rounds = rounds + 1 90 rounds = rounds + 1
91 random.shuffle(peers) 91 random.shuffle(peers)
92 return rounds 92 return rounds
@@ -100,7 +100,7 @@ if __name__ == "__main__":
100 parser.add_argument('--verbose', '-v', action='count') 100 parser.add_argument('--verbose', '-v', action='count')
101 101
102 args = parser.parse_args() 102 args = parser.parse_args()
103 sum = 0.0; 103 sum = 0.0
104 for n in xrange (0, args.r): 104 for n in xrange(0, args.r):
105 sum += simulate(args.k, args.n, args.verbose) 105 sum += simulate(args.k, args.n, args.verbose)
106 print(sum / args.r) 106 print(sum / args.r)