SI_Traktor/field.py
2020-05-03 16:59:29 +02:00

22 lines
630 B
Python

import numpy
import random
class field():
def __init__(self):
self.field_matrix = numpy.random.randint(0, 9, (10, 10))
print("Reprezentacja pola jako macierz:")
print("###################")
for i in self.field_matrix:
for j in i:
print(j, end=" ")
print("")
print("###################")
def get_matrix(self):
return self.field_matrix
def change_value(self, position, value):
self.field_matrix[position[1],position[0]] += value
def get_value(self,position):
return self.field_matrix[position[1],position[0]]