forked from im4media/heresimulation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
here.py
56 lines (42 loc) · 1.44 KB
/
here.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import time
from realm import Realm
from user import User
from post import Post, Reply
if __name__ == "__main__":
#timewarp = 1 #10s *10000 = 100,000 = 30 h
# _pi = 0.03*timewarp # Post
# _ri = 0.05*timewarp # Reply
# _ii = 0.001*timewarp # Invite
# _ui = 0.03*timewarp # Upvote
# _di = 0.003*timewarp # Downvote
# _dwi = 0.01*timewarp # Deposit/Withdraw
realm = Realm()
user = realm.create_user("User 1", 100)
user = realm.create_user("User 2", 100)
user = realm.create_user("User 3", 100)
day = 0
try:
while True:
time.sleep(10)
# Site statistics
print("Day:", day)
print("Number of Users: ", len(realm.users))
print("Number of Posts: ", len(realm.posts))
#print("Median Balance: ", site.average_balance)
print("Total economy(in ¢): ", realm.wallet + realm.average_balance*len(realm.users))
print()
day +=1
if len(realm.users)> 5000:
realm.should_stop = True
break
except KeyboardInterrupt:
realm.should_stop = True
# Clean up
for user in realm.users:
user.thread.join()
# Final data
total_replies = 0
for post in realm.posts:
total_replies += len(post.replies)
print("==========")
print("Total replies:", total_replies)