added requirements.txt

This commit is contained in:
jedryb 2022-06-05 12:53:56 +02:00
parent 2cf7573a57
commit 921aeec597
5 changed files with 16 additions and 8 deletions

4
assets/cnn_model/assets/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -2,10 +2,12 @@ import pygame
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
from src.utils.xgb_model import XgbModel
from src.utils.cnn_model import CnnModel
from src.world import World
from src.tractor import Tractor
from src.settings import Settings
from src.utils.bfs import BFSSearcher
from src.utils.astar import a_star_search
from src.constants import Constants as C
from utils.display_info import display_tile_info
@ -17,6 +19,8 @@ def main():
settings = Settings()
xgb_model = XgbModel()
world = World(settings, xgb_model)
cnn_model = CnnModel(world)
cnn_model.init_model()
tractor = Tractor("Spalinowy", "Nawóz 1", settings, 0 * settings.tile_size, 0 * settings.tile_size, C.RIGHT)
plants_to_water = [tile for tile in world.tiles if tile.to_water == 1]
clock = pygame.time.Clock() # FPS purpose
@ -30,7 +34,7 @@ def main():
cords_idx = tractor.find_nearest_cords(tractor.curr_position, goals)
end_cords = goals[cords_idx]
start_dir = tractor.curr_direction
path = BFSSearcher().search(start_cords, end_cords, start_dir)
path = a_star_search(start_cords, end_cords, start_dir, world)
run = True
while run:
@ -56,7 +60,7 @@ def main():
cords_idx = tractor.find_nearest_cords(tractor.curr_position, goals)
end_cords = goals[cords_idx]
start_dir = tractor.curr_direction
path = BFSSearcher().search(start_cord, end_cords, start_dir)
path = a_star_search(start_cord, end_cords, start_dir, world)
pygame.time.wait(settings.freeze_time)
pygame.display.update()

BIN
requirements.txt Normal file

Binary file not shown.

View File

@ -27,22 +27,22 @@ class Tractor(Sprite):
self.curr_direction = C.RIGHT
self.image = pygame.transform.scale(
pygame.image.load('assets/images/tractor/tractor-transparent-right.png'),
(self.settings.tile_size, self.settings.tile_size))
(self.settings.tile_size - 1, self.settings.tile_size - 1))
elif self.curr_direction == C.RIGHT:
self.curr_direction = C.DOWN
self.image = pygame.transform.scale(
pygame.image.load('assets/images/tractor/tractor-transparent-down.png'),
(self.settings.tile_size, self.settings.tile_size))
(self.settings.tile_size - 1, self.settings.tile_size - 1))
elif self.curr_direction == C.DOWN:
self.curr_direction = C.LEFT
self.image = pygame.transform.scale(
pygame.image.load('assets/images/tractor/tractor-transparent-left.png'),
(self.settings.tile_size, self.settings.tile_size))
(self.settings.tile_size - 1, self.settings.tile_size - 1))
elif self.curr_direction == C.LEFT:
self.curr_direction = C.UP
self.image = pygame.transform.scale(
pygame.image.load('assets/images/tractor/tractor-transparent-up.png'),
(self.settings.tile_size, self.settings.tile_size))
(self.settings.tile_size - 1, self.settings.tile_size - 1))
pygame.time.wait(self.settings.freeze_time) # bez tego sie kreci jak hot-wheels

View File

@ -38,7 +38,7 @@ class World:
for tile in row:
if tile == 1:
type = 'farm' # type farm mówimy nam ogólnie, ze jest to pole uprawne, szczegóły rośliny potem
cost = 0
cost = 100000
stan_nawodnienia = self.model.df.iloc[df_idx]['stan_nawodnienia']
rodzaj_gleby = self.model.df.iloc[df_idx]['rodzaj_gleby']
stan_nawiezienia = self.model.df.iloc[df_idx]['stan_nawiezienia']
@ -68,7 +68,7 @@ class World:
elif tile == 0:
img = pygame.transform.scale(self.rock, (self.settings.tile_size, self.settings.tile_size))
type = 'rock' # podobnie j.w., na polu rock nie mamy upraw
cost = 100
cost = 1
stan_nawodnienia = None
rodzaj_gleby = None