Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@


class SimColor:
"""
Tuples corresponding to RGB colors
"""
"""
Tuples corresponding to RGB colors
"""
LIGHT_GREY = (240, 240, 240)
DARK_GREY = (30, 30, 50)
BLACK = (0, 0, 0)
Expand All @@ -17,9 +17,9 @@ class SimColor:


class Disease:
"""
Constants for disease
"""
"""
Constants for disease
"""
INFECTED = 0
RECOVERED = 1
UNEXPOSED = 2
Expand All @@ -34,9 +34,9 @@ class Disease:


class Screen:
"""
Constants for Screen
"""
"""
Constants for Screen
"""
WIDTH = 680
HEIGHT = 480
FONT_SIZE = 18
Expand Down
8 changes: 6 additions & 2 deletions universe.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ def run(self):
pygame.display.update()

while self.is_epidemic_over:
for e in pygame.event.get():
if e.type == pygame.QUIT:
self.quit()
pygame.display.update()

def progress_healing(self):
Expand All @@ -162,7 +165,8 @@ def progress_healing(self):

if host.condition is Disease.INFECTED:
host.remaining_recovery -= 1

if host.remaining_recovery <= 0:
host.condition = Disease.RECOVERED
host.color = Disease.COLOR_MAP[host.condition]

@staticmethod
Expand Down Expand Up @@ -192,7 +196,7 @@ def is_epidemic_over(self):
Returns true if there are no infected hosts
:return: Boolean
"""
return self.get_population_count(Disease.INFECTED) is 0
return self.get_population_count(Disease.INFECTED) == 0


if __name__ == "__main__":
Expand Down