2024-03-07 18:01:12 +01:00
|
|
|
import pygame
|
2024-03-25 01:03:25 +01:00
|
|
|
import time
|
|
|
|
import random
|
2024-03-07 18:01:12 +01:00
|
|
|
|
2024-04-09 15:02:58 +02:00
|
|
|
from area.constants import WIDTH, HEIGHT, TILE_SIZE
|
2024-03-07 18:01:12 +01:00
|
|
|
from area.field import drawWindow
|
2024-03-25 01:03:25 +01:00
|
|
|
from area.tractor import Tractor
|
|
|
|
from area.field import tiles
|
|
|
|
from ground import Dirt
|
|
|
|
from plant import Plant
|
2024-03-07 18:01:12 +01:00
|
|
|
WIN = pygame.display.set_mode((WIDTH, HEIGHT))
|
|
|
|
pygame.display.set_caption('Intelligent tractor')
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
run = True
|
|
|
|
window = drawWindow(WIN)
|
|
|
|
pygame.display.update()
|
2024-04-09 15:02:58 +02:00
|
|
|
|
|
|
|
|
2024-03-07 18:01:12 +01:00
|
|
|
while run:
|
|
|
|
for event in pygame.event.get():
|
|
|
|
if event.type == pygame.QUIT:
|
|
|
|
run = False
|
|
|
|
|
2024-03-25 01:03:25 +01:00
|
|
|
#small test:
|
|
|
|
time.sleep(2)
|
|
|
|
tile1 = tiles[0]
|
|
|
|
p1 = Plant('wheat', 'cereal', random.randint(1,100), random.randint(1,100), random.randint(1,100))
|
|
|
|
d1 = Dirt(random.randint(1, 100), random.randint(1,100))
|
|
|
|
d1.pests_and_weeds()
|
|
|
|
tile1.ground=d1
|
2024-04-09 15:02:58 +02:00
|
|
|
|
|
|
|
tractor = Tractor(0*TILE_SIZE, 0*TILE_SIZE, 2)
|
|
|
|
tractor.rotate_to_right()
|
|
|
|
tractor.move()
|
|
|
|
tractor.draw_tractor(WIN)
|
|
|
|
|
|
|
|
pygame.display.update()
|
|
|
|
tractor.work_on_field(tile1, d1, p1)
|
2024-03-25 01:03:25 +01:00
|
|
|
time.sleep(3)
|
|
|
|
print("\n")
|
|
|
|
|
|
|
|
|
2024-04-09 15:02:58 +02:00
|
|
|
# in loop move tractor:
|
|
|
|
|
2024-03-07 18:01:12 +01:00
|
|
|
|
|
|
|
main()
|