bug fix
This commit is contained in:
parent
2a00eccaf1
commit
2b829714ac
@ -56,6 +56,7 @@ class Tractor:
|
|||||||
else:
|
else:
|
||||||
return # Nie możemy się ruszyć poza planszę
|
return # Nie możemy się ruszyć poza planszę
|
||||||
|
|
||||||
|
vegetable_name = None
|
||||||
|
|
||||||
if board.vegetables[next_row][next_col]:
|
if board.vegetables[next_row][next_col]:
|
||||||
if board.vegetable_names[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)
|
vegetable_name = predict_image(temp_file_name, self.neuralnetwork)
|
||||||
print(f"TRAKTOR UZNAL ZE TO: {vegetable_name}")
|
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:
|
if board.is_dirt(next_row, next_col) and board.board[next_row][next_col] != 10:
|
||||||
soil_features = board.soil_features
|
soil_features = board.soil_features
|
||||||
sample = {
|
sample = {
|
||||||
@ -77,7 +82,7 @@ class Tractor:
|
|||||||
"proc_ekspo_na_swiatlo": soil_features["proc_ekspo_na_swiatlo"],
|
"proc_ekspo_na_swiatlo": soil_features["proc_ekspo_na_swiatlo"],
|
||||||
"pora_dnia": soil_features["pora_dnia"],
|
"pora_dnia": soil_features["pora_dnia"],
|
||||||
"pora_roku": soil_features["pora_roku"],
|
"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)
|
should_water = predict(self.model, self.feature_columns, sample)
|
||||||
|
Loading…
Reference in New Issue
Block a user