This commit is contained in:
Nikodem145 2024-05-27 13:57:55 +02:00
parent 2a00eccaf1
commit 2b829714ac

View File

@ -56,6 +56,7 @@ class Tractor:
else:
return # Nie możemy się ruszyć poza planszę
vegetable_name = None
if board.vegetables[next_row][next_col]:
if board.vegetable_names[next_row][next_col]:
@ -67,6 +68,10 @@ class Tractor:
vegetable_name = predict_image(temp_file_name, self.neuralnetwork)
print(f"TRAKTOR UZNAL ZE TO: {vegetable_name}")
if vegetable_name in board.vegetable_types:
vegetable_type_number = board.vegetable_types[vegetable_name]
else:
vegetable_type_number = -1
if board.is_dirt(next_row, next_col) and board.board[next_row][next_col] != 10:
soil_features = board.soil_features
sample = {
@ -77,7 +82,7 @@ class Tractor:
"proc_ekspo_na_swiatlo": soil_features["proc_ekspo_na_swiatlo"],
"pora_dnia": soil_features["pora_dnia"],
"pora_roku": soil_features["pora_roku"],
"roslina": "warzywa/" + str(vegetable_name) + ".png"
"roslina": vegetable_type_number
}
should_water = predict(self.model, self.feature_columns, sample)