Zaktualizuj 'main.py'
This commit is contained in:
parent
8f0a1ed075
commit
e77b8d03f9
11
main.py
11
main.py
@ -51,9 +51,12 @@ if __name__ == "__main__":
|
||||
plant_pops = []
|
||||
best_plant_pop = []
|
||||
|
||||
goal_gen = 10
|
||||
goal_gen = 100
|
||||
best_plant_pop, plant_pops, num_of_plants, fitness = ga.genetic_algorithm_setup(field, plant_pops, goal_gen)
|
||||
|
||||
net = nn.Net()
|
||||
nn.load_network_from_structure(net)
|
||||
net.eval()
|
||||
|
||||
# Create Tractor object
|
||||
tractor = T.Tractor(field, [0, 0])
|
||||
@ -117,8 +120,8 @@ if __name__ == "__main__":
|
||||
elif path[0] == "hydrate":
|
||||
tractor.hydrate(field)
|
||||
elif path[0] == "fertilize":
|
||||
tractor.fertilize(field)
|
||||
|
||||
if plants[tractor.position[1]][tractor.position[0]]:
|
||||
tractor.fertilize(field, plants, nn.result_from_network(net, plants[tractor.position[0]][tractor.position[1]].testimage))
|
||||
path.pop(0)
|
||||
|
||||
|
||||
@ -154,4 +157,4 @@ if __name__ == "__main__":
|
||||
pygame.display.flip()
|
||||
|
||||
# Ensure program maintains a stable framerate
|
||||
clock.tick(8)
|
||||
clock.tick(35)
|
||||
|
Loading…
Reference in New Issue
Block a user