removed debug loop from main

master
Marek Baczynski 7 years ago
parent 846613a59d
commit bbfd3c1b30

@ -45,52 +45,27 @@ def save():
with open(config['mealHistoryFile'], 'w') as outfile: with open(config['mealHistoryFile'], 'w') as outfile:
json.dump(mealHistory, outfile) json.dump(mealHistory, outfile)
if __name__ == '__main__': points = {}
points[3] = 52
try: points[4] = 69
with open (configFileName, 'r') as configFile: points[5] = 80
config = json.load(configFile) points[6] = 90
except IOError: points[7] = 102
print "Config file not found! Loading defaults" points[8] = 112
config = {} points[9] = 120
config['ip'] = '127.0.0.1' points[10] = 135
config['port'] = 5000
config['debug'] = True newcommers = ["Rick", "Morty", "Jerry", "Mr Poopy Buthole", "Karl Gustav VII", "Erik"]
config['mealHistoryFile'] = "MealHistory.json"
day = 1
Person("Mark") def newDay():
Person("Davide") global day
Person("Wille")
Person("Sven")
Person("David")
Person("Ahmed")
for name, person in people.iteritems():
person.attendanceRate = 0.2 + random.random() * 0.8
points = {}
points[3] = 52
points[4] = 69
points[5] = 80
points[6] = 90
points[7] = 102
points[8] = 112
points[9] = 120
points[10] = 135
important = ['delicious', 'fabulous', 'very tasty', 'good', 'very good', 'not bad at all', 'favorable', 'ok', 'nutritious', 'italian', 'mouth-watering', 'objectively pleasing', 'aromatic', 'something to write home about', 'probably digestible', 'edible', 'a complex blend of carbon-based chemistry','not sanitized"); DROP TABLE MEALS;--', 'not poisoned', 'of unknown origin', 'crunchy', 'finger-licking good', 'fantastic', 'the best one we had so far', 'fancy', 'extrordinary', 'pleasant'] important = ['delicious', 'fabulous', 'very tasty', 'good', 'very good', 'not bad at all', 'favorable', 'ok', 'nutritious', 'italian', 'mouth-watering', 'objectively pleasing', 'aromatic', 'something to write home about', 'probably digestible', 'edible', 'a complex blend of carbon-based chemistry','not sanitized"); DROP TABLE MEALS;--', 'not poisoned', 'of unknown origin', 'crunchy', 'finger-licking good', 'fantastic', 'the best one we had so far', 'fancy', 'extrordinary', 'pleasant']
newcommers = ["Rick", "Morty", "Jerry", "Mr Poopy Buthole", "Karl Gustav VII", "Erik"]
day = 1
while True:
#somebody-joining module
if len(newcommers) > 0 and random.random() < 0.1: if len(newcommers) > 0 and random.random() < 0.1:
newbe = Person(newcommers.pop()) newbe = Person(newcommers.pop())
newbe.attendanceRate = 0.2 + random.random() * 0.8 newbe.attendanceRate = 0.2 + random.random() * 0.8
print "### NEW MEMBER ###" print "### NEW MEMBER ###"
print "!!! {} has joined the group !!!" print "!!! {} has joined the group !!!"
n_people = 0 n_people = 0
while n_people < 3: while n_people < 3:
attendees = [] attendees = []
@ -149,22 +124,27 @@ if __name__ == '__main__':
print "{} people gained {} KukPoints each".format(n_people-1, payment) print "{} people gained {} KukPoints each".format(n_people-1, payment)
print "The meal was {}!".format(random.choice(important[:day])) print "The meal was {}!".format(random.choice(important[:day]))
#loop and status day = day+1
print "\nWhat now?"
r = raw_input("[C]ontinue | [B]reak | [S]how stats\n") if __name__ == '__main__':
day += 1
if r == 'b': try:
break with open (configFileName, 'r') as configFile:
if(r=='s'): config = json.load(configFile)
print "STATUS:" except IOError:
for name, person in people.iteritems(): print "Config file not found! Loading defaults"
print "{} has {} kukPoints".format(name, str(person.kukPoints)) config = {}
print "\tcooked {} times, a total of {} servings, ate {} times".format(str(person.kukMealCount), str(person.kukServingCount), str(person.eatenCount)) config['ip'] = '127.0.0.1'
print "\nWhat now?" config['port'] = 5000
r = raw_input("[C]ontinue | [B]reak | [S]ince I already showed the stats, this option does nothing\n") config['debug'] = True
if r == 'b': config['mealHistoryFile'] = "MealHistory.json"
break
for mid, meal in mealHistory.iteritems(): Person("Mark")
print "{} kuked for {} people".format(meal.kuk.name, str(len(meal.eaters))) Person("Davide")
print "Thank you for using KUKCOUNTER" Person("Wille")
Person("Sven")
Person("David")
Person("Ahmed")
for name, person in people.iteritems():
person.attendanceRate = 0.2 + random.random() * 0.8

Loading…
Cancel
Save