-
Notifications
You must be signed in to change notification settings - Fork 0
/
Test.py
32 lines (26 loc) · 822 Bytes
/
Test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from ProofOfStake import ProofOfStake
from Lot import Lot
import random
import string
def getRandomString(length):
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for i in range(length))
if __name__ == '__main__':
pos = ProofOfStake()
pos.update("bob", 75)
pos.update("alice", 100)
pos.update("jack", 50)
bobWins = 0
aliceWins = 0
jackWins = 0
for i in range(100):
forger = pos.forger(getRandomString(i))
if forger == "bob":
bobWins += 1
elif forger == "alice":
aliceWins += 1
elif forger == "jack":
jackWins += 1
print("Bob wins: " + str(bobWins) + " times \n\n")
print("Alice wins: " + str(aliceWins) + " times \n\n")
print("Jack wins: " + str(jackWins) + " times \n\n")