/
init.py
71 lines (55 loc) · 1.25 KB
/
init.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#import necessary stuff like pygame
import csv
import time
import kernel
import file_io
import pygame
from pygame.locals import *
#define simulation variables
balance_sheet={}
player_list={}
building_list={}
UIDlist = []
money=0
pollution=0
trash=0
init = 0
asdf = 0
#test variables
#define pygame variable
FPS = 30
WINDOWWIDTH = 640
WINDOWHEIGHT = 480
STATE = None #MAINMENU, LOAD
chosenplayer = 'asdf'
def clamp(n, minn, maxn):
'''Keep values in between values
Arguments:
n: Value
minn: Minimum value
maxn: Maximum value
'''
return max(min(maxn, n), minn)
#load balance sheet
balance_sheet = file_io.load_balance('balance_sheet.csv')
#print(balance_sheet)
#load savefile
player = file_io.load(chosenplayer)
print (player)
init = player[0]
building_list = player[1]
UIDlist = player[2]
money,pollution,trash = init
#print(init)
print(building_list)
print(UIDlist)
#main loop
while True:
money,pollution,trash = kernel.simulate(UIDlist,building_list,balance_sheet,money,pollution,trash)
print('Money is: '+str(money))
print('Pollution is: '+ str(pollution))
print('Trash is: '+ str(trash))
if money <= 0 or pollution >= 100 or trash >= 100:
print("Game over")
break
time.sleep(0.1)