fix trashbin driving from point to point
This commit is contained in:
parent
5ab9a3c30c
commit
776b8aa3b6
31
main.py
31
main.py
@ -1,4 +1,6 @@
|
|||||||
|
from asyncio import sleep
|
||||||
from calendar import c
|
from calendar import c
|
||||||
|
import time
|
||||||
from game_objects.player import Player
|
from game_objects.player import Player
|
||||||
import pygame as pg
|
import pygame as pg
|
||||||
import sys
|
import sys
|
||||||
@ -100,32 +102,31 @@ class Game():
|
|||||||
self.positive_decision = []
|
self.positive_decision = []
|
||||||
self.negative_decision = []
|
self.negative_decision = []
|
||||||
|
|
||||||
self.positive_actions = []
|
|
||||||
self.negative_actions = []
|
|
||||||
for i in self.trashbinTiles:
|
for i in self.trashbinTiles:
|
||||||
atrrs_container = i.get_attributes()
|
atrrs_container = i.get_attributes()
|
||||||
x, y = i.get_coords()
|
x, y = i.get_coords()
|
||||||
dec = decisionTree.decision(getTree(), *atrrs_container)
|
dec = decisionTree.decision(getTree(), *atrrs_container)
|
||||||
if dec[0] == 1:
|
if dec[0] == 1:
|
||||||
self.positive_decision.append(i)
|
self.positive_decision.append(i)
|
||||||
self.positive_actions.append(self.get_actions_by_coords(x, y))
|
|
||||||
else:
|
else:
|
||||||
self.negative_decision.append(i)
|
self.negative_decision.append(i)
|
||||||
self.negative_actions.append(i)
|
|
||||||
|
|
||||||
for i in self.positive_actions:
|
# print('positive actions')
|
||||||
print('----')
|
|
||||||
print(i)
|
|
||||||
print('----')
|
|
||||||
|
|
||||||
# vec = pg.math.Vector2
|
|
||||||
# for i in self.positive_actions:
|
# for i in self.positive_actions:
|
||||||
# self.t.startAiController(i)
|
# print('----')
|
||||||
# self.player.update()
|
# print(i)
|
||||||
# self.player.pos = vec(32, 32)
|
# print('----')
|
||||||
# self.player.update()
|
|
||||||
|
|
||||||
self.t.startAiController(self.positive_actions[0])
|
print('positive actions')
|
||||||
|
print(len(self.positive_actions))
|
||||||
|
for i in self.positive_decision:
|
||||||
|
# print(i.get_coords())
|
||||||
|
trash_x, trash_y = i.get_coords()
|
||||||
|
action = self.get_actions_by_coords(trash_x, trash_y)
|
||||||
|
self.t.startAiController(action)
|
||||||
|
# print(self.positive_actions[0])
|
||||||
|
|
||||||
|
# self.t.startAiController(self.positive_actions[0])
|
||||||
|
|
||||||
|
|
||||||
def load_data(self):
|
def load_data(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user