Dodany plik to raportu, dodane wyszukiwanie DFS, A* w trakcie prac
This commit is contained in:
parent
3f6f41c39c
commit
62319b857e
@ -4,7 +4,7 @@
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="jdk" jdkName="Python 3.8" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -3,5 +3,5 @@
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (SI_Projekt)" project-jdk-type="Python SDK" />
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8" project-jdk-type="Python SDK" />
|
||||
</project>
|
55
functions.py
55
functions.py
@ -2,6 +2,7 @@ import pygame
|
||||
import sys
|
||||
from pygame.locals import *
|
||||
import config
|
||||
from itertools import product, starmap
|
||||
|
||||
|
||||
def quit():
|
||||
@ -29,6 +30,8 @@ def pressed(key, traktor_poz):
|
||||
config.activity.activity_val(2)
|
||||
if key[K_4]:
|
||||
config.activity.activity_val(3)
|
||||
if key[K_p]:
|
||||
pathfinding()
|
||||
|
||||
|
||||
def move_left():
|
||||
@ -99,4 +102,54 @@ def plant(position):
|
||||
config.mat_val([position[0], position[1]], 2)
|
||||
def harvest(position):
|
||||
if config.POLE_STAN[position[0], position[1]] == 8:
|
||||
config.mat_val([position[0], position[1]], -8)
|
||||
config.mat_val([position[0], position[1]], -8)
|
||||
|
||||
|
||||
def heuristic(a, b):
|
||||
(x1, y1) = a
|
||||
(x2, y2) = b
|
||||
return abs(x1 - x2) + abs(y1 - y2)
|
||||
|
||||
|
||||
def pathfinding():
|
||||
activity = config.activity.activity_get_value()
|
||||
avaiable_value = []
|
||||
if activity == 0:
|
||||
avaiable_value = [0,1,2,3]
|
||||
elif activity == 1:
|
||||
avaiable_value = [1,3,5,7]
|
||||
elif activity == 2:
|
||||
avaiable_value = [0,1,4,5]
|
||||
elif activity == 3:
|
||||
avaiable_value = [8]
|
||||
opened = []
|
||||
closed = []
|
||||
start_position = [int(((config.TRAKTOR_POZ[1]-5)/70)-1), int(((config.TRAKTOR_POZ[0]-5)/70)-1)]
|
||||
end_point = search(start_position,avaiable_value)
|
||||
# print(end_point)
|
||||
|
||||
|
||||
closed = []
|
||||
def search(point,values):
|
||||
global closed
|
||||
if config.POLE_STAN[point[0],point[1]] in values:
|
||||
closed = []
|
||||
return point
|
||||
else:
|
||||
closed.append(point)
|
||||
childs = points(point)
|
||||
# print(closed)
|
||||
while childs:
|
||||
child = childs.pop()
|
||||
if child not in closed:
|
||||
return search(child,values)
|
||||
|
||||
|
||||
def points(point):
|
||||
points = []
|
||||
for i in [[point[0],point[1]-1],[point[0]-1,point[1]],[point[0],point[1]+1],[point[0]+1,point[1]]]:
|
||||
if i[0] in [-1,10] or i[1] in [-1,10]:
|
||||
pass
|
||||
else:
|
||||
points.append(i)
|
||||
return points
|
||||
|
5
route-planning.md
Normal file
5
route-planning.md
Normal file
@ -0,0 +1,5 @@
|
||||
# Sztuczna Inteligencja - Raport Route Planning
|
||||
|
||||
**Członkowie zespołu:** Marcin Kwapisz, Kamila Matysiak, Piotr Rychlicki, Justyna Zarzycka
|
||||
|
||||
**Temat projektu:** Inteligentny Traktor
|
Loading…
Reference in New Issue
Block a user