-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathData.py
More file actions
37 lines (30 loc) · 1.11 KB
/
Data.py
File metadata and controls
37 lines (30 loc) · 1.11 KB
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
from DataPoint import DataPoint
# store and array of data so it can be easily drawn on screen
class Data:
# Populates the array of data with random data points
def populate_list(self):
for i in range(0, self.size):
self.my_list.append(DataPoint(self.min, self.max))
# min: minimum number a data point can be
# max: maximum number a data point can be
# size: how many data points the list will contain
def __init__(self, min, max, size):
self.min = min
self.max = max
self.size = size
self.my_list = []
self.populate_list()
# min: minimum number a data point can be
# max: maximum number a data point can be
# size: how many data points the list will contain
# clears the data list and repopulates with new data
def randomize(self, min, max, size):
self.min = min
self.max = max
self.size = size
self.my_list.clear()
self.populate_list()
# draws all data on the screen
def draw(self, screen):
for i in range(0, self.size):
self.my_list[i].draw(screen, i)