diff --git a/algorithms/neural_network/neural_network.py b/algorithms/neural_network/neural_network.py index b1c71ba..171e599 100644 --- a/algorithms/neural_network/neural_network.py +++ b/algorithms/neural_network/neural_network.py @@ -4,7 +4,6 @@ import torch.nn as nn from torch.optim import SGD, Adam, lr_scheduler import torch.nn.functional as F from torch.utils.data import DataLoader -from watersandtreegrass import WaterSandTreeGrass from common.constants import DEVICE, BATCH_SIZE, NUM_EPOCHS, LEARNING_RATE, SETUP_PHOTOS, ID_TO_CLASS diff --git a/algorithms/neural_network/neural_network_interface.py b/algorithms/neural_network/neural_network_interface.py index 613dbc7..c8c2955 100644 --- a/algorithms/neural_network/neural_network_interface.py +++ b/algorithms/neural_network/neural_network_interface.py @@ -1,9 +1,9 @@ import torch import common.helpers +from algorithms.neural_network.neural_network import NeuralNetwork +from algorithms.neural_network.watersandtreegrass import WaterSandTreeGrass from common.constants import DEVICE, BATCH_SIZE, NUM_EPOCHS, LEARNING_RATE, SETUP_PHOTOS, ID_TO_CLASS -from watersandtreegrass import WaterSandTreeGrass from torch.utils.data import DataLoader -from neural_network import NeuralNetwork from torchvision.io import read_image, ImageReadMode import torch.nn as nn from torch.optim import Adam @@ -100,7 +100,7 @@ def what_is_it(img_path, show_img=False): plt.imshow(plt.imread(img_path)) plt.show() image = SETUP_PHOTOS(image).unsqueeze(0) - model = NeuralNetwork.load_from_checkpoint('./lightning_logs/version_13/checkpoints/epoch=4-step=405.ckpt') + model = NeuralNetwork.load_from_checkpoint('./lightning_logs/version_0/checkpoints/epoch=4-step=405.ckpt') with torch.no_grad(): model.eval() diff --git a/common/constants.py b/common/constants.py index 7162709..1e718d3 100644 --- a/common/constants.py +++ b/common/constants.py @@ -6,7 +6,7 @@ GAME_TITLE = 'WMICraft' WINDOW_HEIGHT = 800 WINDOW_WIDTH = 1360 FPS_COUNT = 60 -TURN_INTERVAL = 300 +TURN_INTERVAL = 500 GRID_CELL_PADDING = 5 GRID_CELL_SIZE = 36 diff --git a/logic/game.py b/logic/game.py index 5bf6e60..a94f822 100644 --- a/logic/game.py +++ b/logic/game.py @@ -61,8 +61,8 @@ class Game: if event.key == pygame.K_n: print_numbers_flag = not print_numbers_flag - if event.type == NEXT_TURN: # is called every 'TURN_INTERVAL' milliseconds - level.handle_turn() + # if event.type == NEXT_TURN: # is called every 'TURN_INTERVAL' milliseconds + # level.handle_turn() stats.update() logs.draw() diff --git a/logic/level.py b/logic/level.py index 73dcd8e..306762c 100644 --- a/logic/level.py +++ b/logic/level.py @@ -3,6 +3,7 @@ import random import pygame from algorithms.a_star import a_star, State, TURN_RIGHT, TURN_LEFT, FORWARD +from algorithms.neural_network.neural_network_interface import what_is_it from common.constants import * from learning.decision_tree import DecisionTree from logic.knights_queue import KnightsQueue @@ -31,10 +32,12 @@ class Level: self.knights_queue = None def create_map(self): - self.generate_map() - self.setup_base_tiles() - self.setup_objects() - self.knights_queue = KnightsQueue(self.list_knights_blue, self.list_knights_red) + print("Create map") + print(what_is_it('../../resources/textures/grass1.png')) + # self.generate_map() + # self.setup_base_tiles() + # self.setup_objects() + # self.knights_queue = KnightsQueue(self.list_knights_blue, self.list_knights_red) def generate_map(self): spawner = Spawner(self.map) diff --git a/requirements.txt b/requirements.txt index 8223619..5d58be6 100644 Binary files a/requirements.txt and b/requirements.txt differ