From 9007ea7ae24fc6f904b0f2b272453325e3f949aa Mon Sep 17 00:00:00 2001 From: secret_dude Date: Tue, 22 Jun 2021 23:27:36 +0200 Subject: [PATCH] FINAL2 --- main.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 7c3fbd4..367550f 100644 --- a/main.py +++ b/main.py @@ -12,7 +12,6 @@ from manualSteering import manualSteeringDriver import joblib import pygame - pygame.init() @@ -28,8 +27,9 @@ hitchCounter = 0 loadCounter = 0 toolCounter = - 1 +#środowisko board = Board.generate() - +#agent tractor = Tractor(horizontal_index=-0, vertical_index=0, hitch="nothing", header=False, autodrive=True, direction="RIGHT") @@ -40,10 +40,12 @@ move_list = [] clock = pygame.time.Clock() +#zjawiska pogodowe weather, day_time, temperature, wind, humidy = WeatherConditions.checkConditions() weatherTimer = 0 +#pętla główna działania programu while working: for event in pygame.event.get(): if event.type == pygame.QUIT: @@ -54,17 +56,20 @@ while working: field = board[tractor.horizontal_index][tractor.vertical_index] - if weatherTimer == 2: + if weatherTimer == 5: weatherTimer = 0 weather, day_time, temperature, wind, humidy = WeatherConditions.checkConditions() + #sformulowanie informacji dla drzewa decyzyjnego / lista informacji o aktualnej pogodzie i polu question = [convertToPrediction.convert(field.state, weather, day_time, temperature, wind, humidy)] dtree = joblib.load('treedata\\DecisionTree.pkl') + #przekazanie informacji do drzewa decision = dtree.predict(question) if tractor.autodrive: + # A************* if not move_list and decision == 1: field.state = TractorAction.changeFieldState(field, tractor) istate = graph.Istate(tractor.direction, tractor.horizontal_index, tractor.vertical_index)