-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
98 lines (96 loc) · 2.75 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<<<<<<< HEAD
import pygame
from atoms import Carbon
import random
from matplotlib import pyplot as plt
initial_conc = int(input("Enter initial number of atoms: "))
screen_size = (1280, 720)
screen = pygame.display.set_mode(screen_size)
pygame.display.set_caption("Radioactivity")
clock = pygame.time.Clock()
carbons = []
nitros = []
concentration = []
TIME = []
for i in range(initial_conc):
x = random.randint(0, screen_size[0])
y = random.randint(0, screen_size[1])
carbons.append(Carbon((x, y)))
def plot(x_axis, y_axis):
plt.plot(x_axis, y_axis)
plt.xlabel('Time')
plt.ylabel('Concentration')
plt.title('Concentration Vs Time')
plt.show()
time = 0
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
for carbon in carbons:
if carbon.status == "decayed_and_stable":
nitros.append(carbon)
carbons.remove(carbon)
screen.fill([0, 0, 0])
for carbon in carbons:
carbon.draw(screen)
for nitro in nitros:
nitro.draw(screen)
pygame.display.flip()
num_c = len(carbons)
concentration.append(num_c)
TIME.append(time)
time += 1
clock.tick(60)
=======
import pygame
from atoms import Carbon
import random
from matplotlib import pyplot as plt
initial_conc = int(input("Enter initial number of atoms: "))
screen_size = (1280, 720)
screen = pygame.display.set_mode(screen_size)
pygame.display.set_caption("Radioactivity")
clock = pygame.time.Clock()
carbons = []
nitros = []
concentration = []
TIME = []
for i in range(initial_conc):
x = random.randint(0, screen_size[0])
y = random.randint(0, screen_size[1])
carbons.append(Carbon((x, y)))
def plot(x_axis, y_axis):
plt.plot(x_axis, y_axis)
plt.xlabel('Time')
plt.ylabel('Concentration')
plt.title('Concentration Vs Time')
plt.show()
time = 0
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
for carbon in carbons:
if carbon.status == "decayed_and_stable":
nitros.append(carbon)
carbons.remove(carbon)
screen.fill([0, 0, 0])
for carbon in carbons:
carbon.draw(screen)
for nitro in nitros:
nitro.draw(screen)
pygame.display.flip()
num_c = len(carbons)
concentration.append(num_c)
TIME.append(time)
time += 1
clock.tick(60)
>>>>>>> 52cefcea66ee8dc18dc418f029917ea80aa9b813
plot(TIME, concentration)