2020-05-03 16:59:29 +02:00
|
|
|
import pygame, sys
|
2020-06-03 14:08:43 +02:00
|
|
|
import tractor, pathfinding, field, ui, Justyna, Kamila, Marcin, Piotrek, pathfinding_decision, collective
|
2020-04-06 18:24:02 +02:00
|
|
|
from pygame.locals import *
|
|
|
|
|
2020-05-07 20:00:03 +02:00
|
|
|
pole = field.field()
|
2020-05-03 16:59:29 +02:00
|
|
|
path = pathfinding.pathfinding()
|
|
|
|
traktor = tractor.tractor(pole)
|
|
|
|
UI = ui.game_ui(traktor,pole)
|
2020-05-03 17:13:59 +02:00
|
|
|
j = Justyna.main(traktor,pole,UI,path)
|
2020-05-28 15:03:13 +02:00
|
|
|
k = Kamila.main(traktor,pole,UI,pathfinding_decision.pathfinding_dec())
|
2020-05-03 17:13:59 +02:00
|
|
|
neuro = Marcin.main(traktor,pole,UI,path)
|
|
|
|
p = Piotrek.main(traktor,pole,UI,path)
|
2020-06-03 14:08:43 +02:00
|
|
|
c = collective.main(neuro,j,k,p,traktor,pole,UI,path)
|
2020-04-06 18:24:02 +02:00
|
|
|
pygame.init()
|
2020-05-03 16:59:29 +02:00
|
|
|
UI.update()
|
|
|
|
UI.update()
|
2020-04-06 18:24:02 +02:00
|
|
|
while True:
|
|
|
|
for event in pygame.event.get():
|
|
|
|
if event.type == QUIT:
|
2020-05-03 16:59:29 +02:00
|
|
|
print("Zamykanie...")
|
|
|
|
pygame.quit()
|
|
|
|
sys.exit()
|
2020-04-06 18:24:02 +02:00
|
|
|
elif event.type == KEYDOWN:
|
2020-05-03 16:59:29 +02:00
|
|
|
key = pygame.key.get_pressed()
|
|
|
|
if key[K_d]:
|
|
|
|
traktor.move_right()
|
|
|
|
if key[K_s]:
|
|
|
|
traktor.move_down()
|
|
|
|
if key[K_a]:
|
|
|
|
traktor.move_left()
|
|
|
|
if key[K_w]:
|
|
|
|
traktor.move_up()
|
|
|
|
if key[K_SPACE]:
|
|
|
|
traktor.work()
|
|
|
|
if key[K_1]:
|
|
|
|
traktor.set_mode(0)
|
|
|
|
if key[K_2]:
|
|
|
|
traktor.set_mode(1)
|
|
|
|
if key[K_3]:
|
|
|
|
traktor.set_mode(2)
|
|
|
|
if key[K_4]:
|
|
|
|
traktor.set_mode(3)
|
|
|
|
if key[K_p]:
|
|
|
|
path.pathfinding(traktor,pole,UI)
|
2020-05-03 17:13:59 +02:00
|
|
|
if key[K_F5]:
|
|
|
|
#Dla projektu Justyny
|
|
|
|
j.main()
|
|
|
|
if key[K_F6]:
|
|
|
|
# Dla projektu Kamili
|
|
|
|
k.main()
|
|
|
|
if key[K_F7]:
|
|
|
|
# Dla projektu Marcina
|
|
|
|
neuro.main()
|
|
|
|
if key[K_F8]:
|
|
|
|
# Dla projektu Piotrka
|
|
|
|
p.main()
|
2020-06-03 14:08:43 +02:00
|
|
|
if key[K_F9]:
|
|
|
|
print(pole.if_value(traktor.get_modes_values()))
|
|
|
|
if key[K_F10]:
|
|
|
|
print(traktor.get_poz())
|
|
|
|
if key[K_F11]:
|
|
|
|
print(traktor.get_field_value())
|
2020-06-04 18:56:18 +02:00
|
|
|
if key[K_F12]:
|
2020-06-03 14:08:43 +02:00
|
|
|
c.main()
|
|
|
|
|
2020-05-03 16:59:29 +02:00
|
|
|
UI.update()
|
|
|
|
UI.update()
|
2020-04-08 11:47:33 +02:00
|
|
|
|