das-research/DAS/block.py

28 lines
621 B
Python
Raw Normal View History

2022-11-30 14:28:27 +00:00
#!/bin/python3
import random
class Block:
blockSize = 0
data = []
def __init__(self, size):
self.blockSize = size
self.data = [0] * (self.blockSize*self.blockSize)
def fill(self):
for i in range(self.blockSize*self.blockSize):
self.data[i] = random.randint(1, 9)
def print(self):
dash = "-" * (self.blockSize+2)
print(dash)
for i in range(self.blockSize):
line = "|"
for j in range(self.blockSize):
line += "%i" % self.data[(i*self.blockSize)+j]
print(line+"|")
print(dash)