2021-03-21 12:40:13 +01:00
|
|
|
import definitions
|
2021-04-09 22:49:58 +02:00
|
|
|
import graph
|
2021-04-03 00:16:53 +02:00
|
|
|
import map
|
2021-03-21 12:40:13 +01:00
|
|
|
import plant
|
2021-03-13 22:30:18 +01:00
|
|
|
import pygame
|
2021-04-03 00:16:53 +02:00
|
|
|
import station
|
2021-03-21 12:40:13 +01:00
|
|
|
import tractor
|
2021-03-13 22:30:18 +01:00
|
|
|
pygame.display.set_caption("Smart Tractor")
|
|
|
|
def main():
|
2021-04-03 11:24:39 +02:00
|
|
|
#tworzenie podstawowych obiektów
|
2021-04-03 00:16:53 +02:00
|
|
|
map1 = map.Map([])
|
|
|
|
map1.create_base_map()
|
2021-03-31 12:56:29 +02:00
|
|
|
amount_of_seeds_dict = {"beetroot": definitions.TRACTOR_AMOUNT_OF_SEEDS_EACH_TYPE, "carrot": definitions.TRACTOR_AMOUNT_OF_SEEDS_EACH_TYPE, "potato": definitions.TRACTOR_AMOUNT_OF_SEEDS_EACH_TYPE, "wheat": definitions.TRACTOR_AMOUNT_OF_SEEDS_EACH_TYPE}
|
|
|
|
collected_plants_dict = {"beetroot": 0, "carrot": 0, "potato": 0, "wheat": 0}
|
2021-03-27 21:31:22 +01:00
|
|
|
fertilizer_dict = {"beetroot": definitions.TRACTOR_FERTILIZER, "carrot": definitions.TRACTOR_FERTILIZER, "potato": definitions.TRACTOR_FERTILIZER, "wheat": definitions.TRACTOR_FERTILIZER}
|
2021-04-03 00:16:53 +02:00
|
|
|
station1 = station.Station(collected_plants_dict)
|
2021-04-09 22:49:58 +02:00
|
|
|
tractor1 = tractor.Tractor(amount_of_seeds_dict, collected_plants_dict, definitions.TRACTOR_DIRECTION_SOUTH, fertilizer_dict, definitions.TRACTOR_FUEL, definitions.TRACTOR_WATER_LEVEL, 0, 0)
|
2021-03-23 17:14:46 +01:00
|
|
|
tractor1_rect = pygame.Rect(tractor1.get_x(), tractor1.get_y(), definitions.BLOCK_SIZE, definitions.BLOCK_SIZE)
|
2021-03-13 22:30:18 +01:00
|
|
|
clock = pygame.time.Clock()
|
|
|
|
run = True
|
2021-04-03 11:24:39 +02:00
|
|
|
while run: #pętla główna programu
|
2021-03-21 12:40:13 +01:00
|
|
|
clock.tick(definitions.FPS)
|
2021-03-13 22:30:18 +01:00
|
|
|
for event in pygame.event.get():
|
|
|
|
if event.type == pygame.QUIT:
|
|
|
|
run = False
|
2021-04-09 22:49:58 +02:00
|
|
|
istate = graph.Istate(definitions.TRACTOR_DIRECTION_SOUTH, 0, 0)
|
|
|
|
istate1 = graph.Istate(None, 4, 4)
|
|
|
|
print(graph.graphsearch([], [], istate, graph.succ, istate1))
|
2021-04-09 14:57:52 +02:00
|
|
|
map1.draw_window(tractor1, tractor1_rect)
|
2021-04-03 00:16:53 +02:00
|
|
|
tractor1.tractor1_handle_movement(tractor1_rect)
|
|
|
|
tractor1.do_work(map1, station1, tractor1_rect)
|
|
|
|
plant.Plant.grow_plants(map1)
|
2021-03-13 22:30:18 +01:00
|
|
|
pygame.quit()
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|