This commit is contained in:
lechwolowski 2020-05-05 01:58:05 +02:00
parent 6fe1829459
commit 6ba4378408
8 changed files with 14 additions and 18 deletions

View File

@ -1,6 +1,6 @@
from Deep_Q_Learning.q_gc import Garbage_Collector
from helpler import Render_Element
from models.House import House
from helpler import __render_element__
from models.__house__ import House
from models.Road import Road
from config import MAP_WIDTH, MAP_HEIGHT, NUMBER_OF_HOUSES
import numpy as np
@ -12,7 +12,7 @@ class GC_Env:
ACTION_SPACE_SIZE = 6
def reset(self):
self.draw_items = {(x, y): Render_Element(x, y)
self.draw_items = {(x, y): __render_element__(x, y)
for x in range(MAP_WIDTH) for y in range(MAP_HEIGHT)}
self.gc = Garbage_Collector(self.draw_items)
self.actions = {

View File

@ -1,7 +1,7 @@
import pygame
from config import CELL_SIZE, MAP_HEIGHT, MAP_WIDTH, MAP, FONT, BLACK, BLUE, GREEN, YELLOW, GARBAGE_COLLECTOR_IMAGE, TRASH_TYPES
from random import randint
from models.House import House
from models.__house__ import House
from models.Numbers import Numbers
from models.Trash import Trash

View File

@ -1,4 +1,4 @@
from models.House import House
from models.__house__ import House
from math import fabs
from models.Trash import Trash
from config import MAP_HEIGHT, MAP_WIDTH, MAP

View File

@ -1,6 +1,6 @@
from models.Road import Road
from models.Grass import Grass
from models.House import House
from models.__grass__ import Grass
from models.__house__ import House
from models.Trash import Trash
from config import MAP_HEIGHT, MAP_WIDTH, MAP

View File

@ -5,7 +5,7 @@ import pygame
from config import CELL_SIZE, BLACK, BLUE, GREEN, YELLOW, FONT
class Numbers (pygame.sprite.Sprite):
class Numbers(pygame.sprite.Sprite):
def __init__(self, x, y):
self.col = x
self.row = y

View File

@ -2,7 +2,7 @@ from random import randint
import pygame
from config import CELL_SIZE, MAP_HEIGHT, MAP_WIDTH, MAP, \
BLACK, BLUE, GREEN, YELLOW, GARBAGE_COLLECTOR_IMAGE, TRASH_TYPES
from models.House import House
from models.__house__ import House
from models.Numbers import Numbers
from models.Trash import Trash

View File

@ -2,10 +2,10 @@ import pygame
from config import CELL_SIZE
class Grass (pygame.sprite.Sprite):
def __init__(self, x, y):
class Grass(pygame.sprite.Sprite):
def __init__(self, __x__, __y__):
pygame.sprite.Sprite.__init__(self)
self.rect = pygame.Rect(
x * CELL_SIZE, y * CELL_SIZE, CELL_SIZE, CELL_SIZE)
__x__ * CELL_SIZE, __y__ * CELL_SIZE, CELL_SIZE, CELL_SIZE)
self.image = pygame.transform.scale(pygame.image.load(
"Resources/Images/grass.png"), (CELL_SIZE, CELL_SIZE))

View File

@ -1,13 +1,10 @@
import pygame
from config import CELL_SIZE, FONT, BLACK, BLUE, GREEN, YELLOW, HOUSE_IMAGE
from random import randint
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
from config import FONT, BLACK, BLUE, GREEN, YELLOW, HOUSE_IMAGE
from models.Numbers import Numbers
class House (Numbers):
class House(Numbers):
def __init__(self, x, y):
Numbers.__init__(self, x, y)
self.zero = 0
@ -21,7 +18,6 @@ class House (Numbers):
def update(self):
draw, font, img = self.img_load(HOUSE_IMAGE, 32)
font = ImageFont.truetype(FONT, 14)
w, h = draw.textsize(str(self.mixed), font=font)
draw.text((19, 24), str(self.mixed), BLACK, font=font)
draw.text((37, 24), str(self.paper), BLUE, font=font)
draw.text((19, 42), str(self.glass), GREEN, font=font)