roslina umiera po zlym nawiezieniu

This commit is contained in:
tafit0902 2024-05-26 01:55:40 +02:00
parent de0740d34b
commit d2abac6ebd

View File

@ -194,11 +194,15 @@ class Tractor:
def snake_move_predict_plant(self, pole, model):
initPos = (self.slot.x_axis, self.slot.y_axis)
count = 0
for i in range(initPos[1], dCon.NUM_Y):
for j in range(initPos[0], dCon.NUM_X):
if self.slot.imagePath != None:
predictedLabel = nn.predictLabel(self.slot.imagePath, model)
print(str("Coords: ({:02d}, {:02d})").format(self.slot.x_axis, self.slot.y_axis), "real:", self.slot.label, "predicted:", predictedLabel, "correct" if (self.slot.label == predictedLabel) else "incorrect", 'nawożę za pomocą:', nn.fertilizer[predictedLabel])
if self.slot.label != predictedLabel:
self.slot.mark_visited()
count += 1
self.move_forward(pole, False)
if i % 2 == 0 and i != dCon.NUM_Y - 1:
self.turn_right()
@ -208,6 +212,7 @@ class Tractor:
self.turn_left()
self.move_forward(pole, False)
self.turn_left()
print(f"źle nawiezionych roślin: {count}")
def snake_move(self,pole,x,y):
next_slot_coordinates=(x,y)