bug fix
This commit is contained in:
parent
2a00eccaf1
commit
2b829714ac
13
tractor.py
13
tractor.py
@ -42,7 +42,7 @@ class Tractor:
|
|||||||
self.direction = "left"
|
self.direction = "left"
|
||||||
elif self.direction == "left":
|
elif self.direction == "left":
|
||||||
self.direction = "up"
|
self.direction = "up"
|
||||||
|
|
||||||
|
|
||||||
def move_forward(self, board):
|
def move_forward(self, board):
|
||||||
if self.direction == "up" and self.row > 0:
|
if self.direction == "up" and self.row > 0:
|
||||||
@ -56,7 +56,8 @@ 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]:
|
||||||
print(f"Powinno być: {board.vegetable_names[next_row][next_col]}")
|
print(f"Powinno być: {board.vegetable_names[next_row][next_col]}")
|
||||||
@ -66,7 +67,11 @@ class Tractor:
|
|||||||
pygame.image.save(vegetable_surface, temp_file_name)
|
pygame.image.save(vegetable_surface, temp_file_name)
|
||||||
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