-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
75 lines (61 loc) · 2.16 KB
/
main.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
72
73
74
75
import time
class Organelle:
def __init__(self, name, function_description):
self.name = name
self.function_description = function_description
self.active = False
def perform_function(self):
if self.active:
self.visualize_action()
def activate(self):
self.active = True
self.visualize_action()
def deactivate(self):
self.active = False
def visualize_action(self):
print(f"{self.name} is performing: {self.function_description}")
class EukaryoticCell:
def __init__(self):
self.nucleus = Organelle("Nucleus", "Controls cell activities")
self.mitochondria = Organelle("Mitochondria", "Produces energy")
self.ser = Organelle("Smooth ER", "Synthesizes lipids")
self.golgi_app = Organelle("Golgi Apparatus", "Processes proteins")
self.lysosome = Organelle("Lysosome", "Breaks down waste")
self.ticks = 0
self.cell_count = 1
def tick(self):
self.ticks += 1
if self.ticks % 5 == 0:
self.activate_protein_synthesis()
if self.ticks % 10 == 0:
self.activate_energy_production()
if self.ticks % 15 == 0:
self.activate_lysosome()
if self.ticks % 20 == 0:
self.activate_mitosis()
def activate_protein_synthesis(self):
self.nucleus.activate()
self.ser.activate()
self.golgi_app.activate()
self.nucleus.perform_function()
self.ser.perform_function()
self.golgi_app.perform_function()
def activate_energy_production(self):
self.mitochondria.activate()
self.mitochondria.perform_function()
def activate_lysosome(self):
self.lysosome.activate()
self.lysosome.perform_function()
def activate_mitosis(self):
self.cell_count += 1
print("Mitosis activated: New cell created.")
self.create_organelles()
def create_organelles(self):
print(f"Creating organelles for new cell. Total cells: {self.cell_count}")
def main():
cell = EukaryoticCell()
while True:
cell.tick()
time.sleep(1)
if __name__ == "__main__":
main()