-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.py
More file actions
29 lines (22 loc) · 686 Bytes
/
Test.py
File metadata and controls
29 lines (22 loc) · 686 Bytes
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
from ProofOfStake import ProofOfStake
from Lot import Lot
import string
import random
def getRandomString(length):
letters = string.ascii_lowercase
resultString = ''.join(random.choice(letters) for i in range(length))
return resultString
if __name__ == '__main__':
pos = ProofOfStake()
pos.update('bob', 100)
pos.update('alice', 100)
bobWins = 0
aliceWins = 0
for i in range(100):
forger = pos.forger(getRandomString(i))
if forger == 'bob':
bobWins += 1
elif forger == 'alice':
aliceWins += 1
print('Bob won: ' + str(bobWins) + ' times')
print('Alice won: ' + str(aliceWins) + ' times')