-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGenerator.py
More file actions
31 lines (23 loc) · 794 Bytes
/
Generator.py
File metadata and controls
31 lines (23 loc) · 794 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
30
31
from random import randint, choice
from Coder import Coder
class Generator:
NUMBER_OF_BITS_IN_MESSAGE = 500
NUMBER_OF_BITS_IN_PACKET = 10
message = []
@staticmethod
def set_number_of_bits_in_message(number_of_bits_in_message):
Generator.number_of_bits_in_message = number_of_bits_in_message
@staticmethod
def make_message():
bits = []
for x in range(Generator.NUMBER_OF_BITS_IN_MESSAGE):
bits.append(randint(0, 1))
Generator.read_message(bits)
Coder.message_divide(bits)
Generator.message = bits
@staticmethod
def read_message(message):
print("Message:")
for i in range(0, len(message)):
print(message[i], end=" ")
print()