refactor #26

Merged
s481834 merged 34 commits from refactor into master 2024-06-04 13:25:11 +02:00
Showing only changes of commit d2abac6ebd - Show all commits

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)