-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimulationInstructions.py
More file actions
29 lines (21 loc) · 943 Bytes
/
SimulationInstructions.py
File metadata and controls
29 lines (21 loc) · 943 Bytes
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
# Maryna Korolova Part starts here >:)
class SimulationInstructionsBuilder:
def __init__(self):
self.instructions: dict[str, List[Instruction]] = {}
def build(self):
return SimulationInstructions(self)
def set_instructions(self, instructions):
self.instructions = instructions
return self
class SimulationInstructions:
def __init__ (self, builder:SimulationInstructionsBuilder):
self.__instructions: dict[str, List[Instruction]] = builder.instructions
def get_instructions(self):
return self.__instructions
def get_total_instructions_count(self):
total_instructions_count = 0
for filename, instructions in self.__instructions.items():
for instruction in instructions:
if instruction.get_instruction_type() == "instruction":
total_instructions_count += 1
return total_instructions_count