-Uproszczenie kodu
-Dodanie wizualizacji dostępnych pól -Zwiększenie rozmiaru klatek -Zwiększenie ilości zwierząt -Poprawienie spawnowania zwierząt
This commit is contained in:
parent
5747db6aab
commit
a8814a763b
2
agent.py
2
agent.py
@ -9,7 +9,6 @@ class Agent:
|
|||||||
self.image= pygame.image.load(image_path)
|
self.image= pygame.image.load(image_path)
|
||||||
self.image = pygame.transform.scale(self.image, (grid_size, grid_size))
|
self.image = pygame.transform.scale(self.image, (grid_size, grid_size))
|
||||||
|
|
||||||
|
|
||||||
def draw(self, screen, grid_size):
|
def draw(self, screen, grid_size):
|
||||||
# Obróć obrazek zgodnie z kierunkiem
|
# Obróć obrazek zgodnie z kierunkiem
|
||||||
if self.direction == 'E':
|
if self.direction == 'E':
|
||||||
@ -56,6 +55,7 @@ class Agent:
|
|||||||
elif action == 'Turn Right':
|
elif action == 'Turn Right':
|
||||||
self.direction = {'N': 'E', 'E': 'S', 'S': 'W', 'W': 'N'}[self.direction]
|
self.direction = {'N': 'E', 'E': 'S', 'S': 'W', 'W': 'N'}[self.direction]
|
||||||
|
|
||||||
|
self.istate = (self.x, self.y, self.direction)
|
||||||
feed_animal(self, animals)
|
feed_animal(self, animals)
|
||||||
|
|
||||||
def feed_animal(self, animals):
|
def feed_animal(self, animals):
|
||||||
|
52
enclosure.py
52
enclosure.py
@ -23,57 +23,13 @@ class Enclosure:
|
|||||||
pygame.draw.rect(screen, (0, 0, 0), rect) # Fill the area with
|
pygame.draw.rect(screen, (0, 0, 0), rect) # Fill the area with
|
||||||
screen.blit(self.imageGate, (gate_x * grid_size, gate_y * grid_size))
|
screen.blit(self.imageGate, (gate_x * grid_size, gate_y * grid_size))
|
||||||
|
|
||||||
def gateopen(self, blocked):
|
def draw(self,screen, grid_size):
|
||||||
gate_x, gate_y = self.gate
|
|
||||||
gate_x -= 1
|
|
||||||
gate_y -= 1
|
|
||||||
if (gate_x, gate_y) in blocked:
|
|
||||||
blocked.remove((gate_x, gate_y))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def draw(self,screen, grid_size , blocked_fields):
|
|
||||||
self.imageH = pygame.transform.scale(self.imageH, (grid_size, grid_size))
|
self.imageH = pygame.transform.scale(self.imageH, (grid_size, grid_size))
|
||||||
self.imageV = pygame.transform.scale(self.imageV, (grid_size, grid_size))
|
self.imageV = pygame.transform.scale(self.imageV, (grid_size, grid_size))
|
||||||
if self.x1 < self.x2:
|
if self.x1 < self.x2:
|
||||||
for i in range(self.x1, self.x2+1):
|
for i in range(self.x1, self.x2+1):
|
||||||
screen.blit(self.imageH, (i * grid_size, self.y1 * grid_size))
|
screen.blit(self.imageH, (i * grid_size, self.y1 * grid_size))
|
||||||
blocked_fields.add((i, self.y1))
|
|
||||||
screen.blit(self.imageH, (i * grid_size, self.y2 * grid_size))
|
screen.blit(self.imageH, (i * grid_size, self.y2 * grid_size))
|
||||||
blocked_fields.add((i, self.y2))
|
for j in range(self.y1, self.y2+1):
|
||||||
if self.y1 < self.y2:
|
screen.blit(self.imageV, (self.x1 * grid_size, j * grid_size))
|
||||||
for j in range(self.y1, self.y2+1):
|
screen.blit(self.imageV, (self.x2 * grid_size, j * grid_size))
|
||||||
screen.blit(self.imageH, (self.x1 * grid_size, j * grid_size))
|
|
||||||
blocked_fields.add((self.x1, j))
|
|
||||||
screen.blit(self.imageH, (self.x2 * grid_size, j * grid_size))
|
|
||||||
blocked_fields.add((self.x2, j))
|
|
||||||
if self.y1 > self.y2:
|
|
||||||
for j in range(self.y2, self.y1+1):
|
|
||||||
screen.blit(self.imageH, (self.x1 * grid_size, j * grid_size))
|
|
||||||
blocked_fields.add((self.x1, j))
|
|
||||||
screen.blit(self.imageH, (self.x2 * grid_size, j * grid_size))
|
|
||||||
blocked_fields.add((self.x2, j))
|
|
||||||
if self.x1 > self.x2:
|
|
||||||
for i in range(self.x2, self.x1+1):
|
|
||||||
screen.blit(self.imageH, (i * grid_size, self.y1 * grid_size))
|
|
||||||
blocked_fields.add((i, self.y1))
|
|
||||||
screen.blit(self.imageH, (i * grid_size, self.y2 * grid_size))
|
|
||||||
blocked_fields.add((i, self.y2))
|
|
||||||
if self.y1 < self.y2:
|
|
||||||
for j in range(self.y1, self.y2+1):
|
|
||||||
screen.blit(self.imageH, (self.x1 * grid_size, j * grid_size))
|
|
||||||
blocked_fields.add((self.x1, j))
|
|
||||||
screen.blit(self.imageH, (self.x2 * grid_size, j * grid_size))
|
|
||||||
blocked_fields.add((self.x2, j))
|
|
||||||
if self.y1 > self.y2:
|
|
||||||
for j in range(self.y2, self.y1+1):
|
|
||||||
screen.blit(self.imageH, (self.x1 * grid_size, j * grid_size))
|
|
||||||
blocked_fields.add((self.x1, j))
|
|
||||||
screen.blit(self.imageH, (self.x2 * grid_size, j * grid_size))
|
|
||||||
blocked_fields.add((self.x2, j))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
BIN
images/agent.png
BIN
images/agent.png
Binary file not shown.
Before Width: | Height: | Size: 5.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 12 KiB |
154
main.py
154
main.py
@ -31,31 +31,48 @@ fenceH = pygame.image.load('images/fenceHor.png')
|
|||||||
fenceV = pygame.image.load('images/fenceVer.png')
|
fenceV = pygame.image.load('images/fenceVer.png')
|
||||||
gate = pygame.image.load('images/gate.png')
|
gate = pygame.image.load('images/gate.png')
|
||||||
|
|
||||||
|
obstacles = set()
|
||||||
fences = set()
|
|
||||||
animals_position = set()
|
animals_position = set()
|
||||||
|
|
||||||
|
# region Define the animals
|
||||||
|
giraffe1 = Giraffe(0, 0, adult=True)
|
||||||
|
giraffe2 = Giraffe(0, 0, adult=True)
|
||||||
|
giraffe3 = Giraffe(0, 0, adult=True)
|
||||||
|
giraffe4 = Giraffe(0, 0)
|
||||||
|
giraffe5 = Giraffe(0, 0)
|
||||||
|
bear1 = Bear(0, 0, adult=True)
|
||||||
|
bear2 = Bear(0, 0, adult=True)
|
||||||
|
bear3 = Bear(0, 0)
|
||||||
|
bear4 = Bear(0, 0)
|
||||||
|
bear5 = Bear(0, 0)
|
||||||
|
penguin1 = Penguin(0, 0)
|
||||||
|
penguin2 = Penguin(0, 0)
|
||||||
|
penguin3 = Penguin(0, 0)
|
||||||
|
penguin4 = Penguin(0, 0)
|
||||||
|
elephant1 = Elephant(0, 0, adult=True)
|
||||||
|
elephant2 = Elephant(0, 0, adult=True)
|
||||||
|
elephant3 = Elephant(0, 0)
|
||||||
|
elephant4 = Elephant(0, 0)
|
||||||
|
elephant5 = Elephant(0, 0)
|
||||||
|
parrot1 = Parrot(0, 0)
|
||||||
|
parrot2 = Parrot(0, 0)
|
||||||
|
parrot3 = Parrot(0, 0)
|
||||||
|
parrot4 = Parrot(0, 0)
|
||||||
|
parrot5 = Parrot(0, 0)
|
||||||
|
|
||||||
|
Animals = [giraffe1, giraffe2, giraffe3, giraffe4, giraffe5, bear1, bear2, bear3, bear4, bear5, elephant1, elephant2, elephant3, elephant4, elephant5, penguin1, penguin2, penguin3, penguin4, parrot1, parrot2, parrot3, parrot4, parrot5]
|
||||||
|
# endregion
|
||||||
|
|
||||||
an1 = Parrot(16, 2)
|
# region Define Enclosures
|
||||||
an2 = Penguin(8, 6)
|
|
||||||
an3 = Bear(14, 9)
|
|
||||||
old_an2 = Giraffe(18,4, adult=True)
|
|
||||||
old_an1 = Elephant(4, 7, adult=True)
|
|
||||||
an4 = Elephant(4,3)
|
|
||||||
|
|
||||||
Animals = [an1, an2, an3, an4, old_an1, old_an2]
|
|
||||||
|
|
||||||
# Enclosure (lewy_górny_x, lewy_górny_y, prawy_dolny_x, prawy_dolny_y, brama, klimat, fenceH, fenceV, gate_obrazek)
|
# Enclosure (lewy_górny_x, lewy_górny_y, prawy_dolny_x, prawy_dolny_y, brama, klimat, fenceH, fenceV, gate_obrazek)
|
||||||
en1 = Enclosure(1,5, 9,11, (9,6),"medium", fenceH, fenceV, gate)
|
en1 = Enclosure(0,5, 9,11, (9,6),"hot", fenceH, fenceV, gate) # Lewa klatka
|
||||||
en2 = Enclosure(13,1, 29,3, (16,3), 'medium', fenceH, fenceV, gate)
|
en2 = Enclosure(13,0, 29,3, (16,3), 'medium', fenceH, fenceV, gate) # Górna klatka
|
||||||
en3 = Enclosure(11,5, 16,11, (12,5),'cold', fenceH, fenceV, gate)
|
en3 = Enclosure(11,5, 16,11, (12,5),'cold', fenceH, fenceV, gate) # Środkowa klatka
|
||||||
en4 = Enclosure(19,5, 30,11, (25,5),'hot', fenceH, fenceV, gate)
|
en4 = Enclosure(19,5, 31,11, (25,5),'hot', fenceH, fenceV, gate) # Prawa klatka
|
||||||
en5 = Enclosure(4,13, 28,15, (16,13),'cold', fenceH, fenceV, gate)
|
en5 = Enclosure(4,13, 28,16, (16,13),'cold', fenceH, fenceV, gate) # Dolna klatka
|
||||||
|
|
||||||
|
|
||||||
Enclosures = [en1, en2, en3, en4, en5]
|
Enclosures = [en1, en2, en3, en4, en5]
|
||||||
|
# endregion
|
||||||
|
|
||||||
def draw_grid():
|
def draw_grid():
|
||||||
for y in range(0, GRID_HEIGHT * GRID_SIZE, GRID_SIZE):
|
for y in range(0, GRID_HEIGHT * GRID_SIZE, GRID_SIZE):
|
||||||
@ -65,16 +82,12 @@ def draw_grid():
|
|||||||
|
|
||||||
def draw_enclosures():
|
def draw_enclosures():
|
||||||
for enclosure in Enclosures:
|
for enclosure in Enclosures:
|
||||||
enclosure.draw(screen, GRID_SIZE, fences)
|
enclosure.draw(screen, GRID_SIZE)
|
||||||
|
|
||||||
def draw_gates():
|
def draw_gates():
|
||||||
for enclosure in Enclosures:
|
for enclosure in Enclosures:
|
||||||
enclosure.gatebuild(screen, GRID_SIZE)
|
enclosure.gatebuild(screen, GRID_SIZE)
|
||||||
|
|
||||||
def opengates():
|
|
||||||
for enclosure in Enclosures:
|
|
||||||
enclosure.gateopen(fences)
|
|
||||||
|
|
||||||
def draw_Animals():
|
def draw_Animals():
|
||||||
for Animal in Animals:
|
for Animal in Animals:
|
||||||
Animal.draw(screen, GRID_SIZE)
|
Animal.draw(screen, GRID_SIZE)
|
||||||
@ -86,10 +99,10 @@ def draw_Animals():
|
|||||||
def spawn_all_animals():
|
def spawn_all_animals():
|
||||||
for Animal in Animals:
|
for Animal in Animals:
|
||||||
spawner1 = Spawner(Animal, Enclosures)
|
spawner1 = Spawner(Animal, Enclosures)
|
||||||
spawner1.spawn_animal(fences, animals_position)
|
spawner1.spawn_animal(obstacles, animals_position)
|
||||||
|
|
||||||
|
obstacles = set()
|
||||||
def generate_obstacles():
|
def generate_obstacles():
|
||||||
obstacles = []
|
|
||||||
|
|
||||||
for en in Enclosures:
|
for en in Enclosures:
|
||||||
# Pobierz współrzędne bramy
|
# Pobierz współrzędne bramy
|
||||||
@ -100,60 +113,70 @@ def generate_obstacles():
|
|||||||
# Dodaj lewy brzeg prostokąta
|
# Dodaj lewy brzeg prostokąta
|
||||||
for y in range(en.y1, en.y2 + 1):
|
for y in range(en.y1, en.y2 + 1):
|
||||||
if (en.x1, y) != (gate_x, gate_y):
|
if (en.x1, y) != (gate_x, gate_y):
|
||||||
obstacles.append((en.x1, y))
|
obstacles.add((en.x1, y))
|
||||||
|
|
||||||
# Dodaj prawy brzeg prostokąta
|
# Dodaj prawy brzeg prostokąta
|
||||||
for y in range(en.y1, en.y2 + 1):
|
for y in range(en.y1, en.y2 + 1):
|
||||||
if (en.x2, y) != (gate_x, gate_y):
|
if (en.x2, y) != (gate_x, gate_y):
|
||||||
obstacles.append((en.x2, y))
|
obstacles.add((en.x2, y))
|
||||||
|
|
||||||
# Dodaj górny brzeg prostokąta
|
# Dodaj górny brzeg prostokąta
|
||||||
for x in range(en.x1+1, en.x2):
|
for x in range(en.x1+1, en.x2):
|
||||||
if (x, en.y1) != (gate_x, gate_y):
|
if (x, en.y1) != (gate_x, gate_y):
|
||||||
obstacles.append((x, en.y1))
|
obstacles.add((x, en.y1))
|
||||||
|
|
||||||
# Dodaj dolny brzeg prostokąta
|
# Dodaj dolny brzeg prostokąta
|
||||||
for x in range(en.x1+1, en.x2):
|
for x in range(en.x1+1, en.x2):
|
||||||
if (x, en.y2) != (gate_x, gate_y):
|
if (x, en.y2) != (gate_x, gate_y):
|
||||||
obstacles.append((x, en.y2))
|
obstacles.add((x, en.y2))
|
||||||
|
|
||||||
return obstacles
|
return obstacles
|
||||||
|
|
||||||
# region Obstacles Tests
|
available_fields_small = set()
|
||||||
# WHITE = (255,255,255)
|
available_fields_large = set()
|
||||||
# TRANSPARENT_BLACK = (0, 0, 0, 128) # Półprzezroczysty czarny
|
def generate_available_fields():
|
||||||
# def draw_obstacles(obstacles):
|
for enclosure in Enclosures:
|
||||||
# for obstacle in obstacles:
|
for x in range(enclosure.x1 + 1, enclosure.x2):
|
||||||
# x, y = obstacle
|
for y in range(enclosure.y1 + 1, enclosure.y2):
|
||||||
# pygame.draw.rect(screen, TRANSPARENT_BLACK, (x * GRID_SIZE, y * GRID_SIZE, GRID_SIZE, GRID_SIZE))
|
field = (x, y)
|
||||||
|
if field not in obstacles:
|
||||||
|
available_fields_small.add(field)
|
||||||
|
if x < enclosure.x2 - 1 and y < enclosure.y2 - 1:
|
||||||
|
available_fields_large.add(field)
|
||||||
|
|
||||||
# def main():
|
# region Fields Tests
|
||||||
# obstacles = generate_obstacles() # Załóżmy, że masz funkcję generate_obstacles, która generuje listę przeszkód
|
WHITE = (255,255,255)
|
||||||
|
GREEN = (0, 255, 0)
|
||||||
|
YELLOW = (255, 255, 0)
|
||||||
|
BLACK = (0, 0, 0)
|
||||||
|
|
||||||
# # Pętla główna
|
def draw_fields(fields, color):
|
||||||
# running = True
|
for field in fields:
|
||||||
# while running:
|
x, y = field
|
||||||
# # Obsługa zdarzeń
|
pygame.draw.rect(screen, color, (x * GRID_SIZE, y * GRID_SIZE, GRID_SIZE, GRID_SIZE))
|
||||||
# for event in pygame.event.get():
|
|
||||||
# if event.type == pygame.QUIT:
|
|
||||||
# running = False
|
|
||||||
|
|
||||||
# # Czyszczenie ekranu
|
def main_fields_tests():
|
||||||
# screen.fill(WHITE)
|
obstacles = generate_obstacles()
|
||||||
|
|
||||||
# # Rysowanie przeszkód
|
|
||||||
# draw_obstacles(obstacles)
|
|
||||||
|
|
||||||
# # Odświeżenie ekranu
|
while True:
|
||||||
# pygame.display.flip()
|
screen.fill(WHITE)
|
||||||
|
|
||||||
# # Wyjście z Pygame
|
draw_grid()
|
||||||
# pygame.quit()
|
draw_fields(obstacles, BLACK)
|
||||||
|
|
||||||
|
generate_available_fields()
|
||||||
|
|
||||||
|
draw_fields(available_fields_small, GREEN)
|
||||||
|
draw_fields(available_fields_large, YELLOW)
|
||||||
|
|
||||||
|
# Odświeżenie ekranu
|
||||||
|
pygame.display.flip()
|
||||||
# endregion
|
# endregion
|
||||||
|
|
||||||
|
# region Main Code
|
||||||
def main():
|
def main():
|
||||||
initial_state = (1,1,'W')
|
initial_state = (0,0,'S')
|
||||||
agent = Agent(initial_state, 'images/agent1.png', GRID_SIZE)
|
agent = Agent(initial_state, 'images/agent1.png', GRID_SIZE)
|
||||||
|
|
||||||
obstacles = generate_obstacles()
|
obstacles = generate_obstacles()
|
||||||
@ -163,6 +186,7 @@ def main():
|
|||||||
|
|
||||||
spawned = False
|
spawned = False
|
||||||
while True:
|
while True:
|
||||||
|
# Manualne poruszanie agentem
|
||||||
for event in pygame.event.get():
|
for event in pygame.event.get():
|
||||||
if event.type == pygame.QUIT:
|
if event.type == pygame.QUIT:
|
||||||
pygame.quit()
|
pygame.quit()
|
||||||
@ -175,25 +199,27 @@ def main():
|
|||||||
draw_gates()
|
draw_gates()
|
||||||
if not spawned:
|
if not spawned:
|
||||||
spawn_all_animals()
|
spawn_all_animals()
|
||||||
|
|
||||||
# region Test szukania ścieżki
|
|
||||||
for animal in Animals:
|
for animal in Animals:
|
||||||
animal._feed = 2 # Ustawienie aby zwierzę było głodne
|
animal._feed = 2 # Ustawienie aby zwierzę było głodne
|
||||||
animal = random.choice(Animals)
|
|
||||||
# actions = graphsearch(agent.istate, (animal.x, animal.y), GRID_WIDTH, GRID_HEIGHT, obstacles)
|
|
||||||
# endregion
|
|
||||||
|
|
||||||
spawned = True
|
spawned = True
|
||||||
draw_Animals()
|
draw_Animals()
|
||||||
opengates()
|
|
||||||
agent.draw(screen, GRID_SIZE)
|
agent.draw(screen, GRID_SIZE)
|
||||||
pygame.display.flip()
|
pygame.display.flip()
|
||||||
clock.tick(10)
|
clock.tick(10)
|
||||||
|
|
||||||
if actions:
|
if actions:
|
||||||
action = actions.pop(0)
|
action = actions.pop(0)
|
||||||
agent.move(action, GRID_WIDTH, GRID_HEIGHT, obstacles, Animals)
|
agent.move(action, GRID_WIDTH, GRID_HEIGHT, obstacles, Animals)
|
||||||
pygame.time.wait(200)
|
pygame.time.wait(200)
|
||||||
|
else:
|
||||||
|
animal = random.choice(Animals)
|
||||||
|
actions = graphsearch(agent.istate, (animal.x, animal.y), GRID_WIDTH, GRID_HEIGHT, obstacles)
|
||||||
|
# endregion
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
debug_mode = False # Jeśli True to pokazuje dostępne pola
|
||||||
|
|
||||||
|
if debug_mode:
|
||||||
|
main_fields_tests()
|
||||||
|
else:
|
||||||
|
main()
|
||||||
|
48
spawner.py
48
spawner.py
@ -1,44 +1,42 @@
|
|||||||
import random
|
import random
|
||||||
|
|
||||||
|
|
||||||
class Spawner:
|
class Spawner:
|
||||||
def __init__(self, animal, enclosures):
|
def __init__(self, animal, enclosures):
|
||||||
self.animal = animal
|
self.animal = animal
|
||||||
self.enclosures = enclosures
|
# Wyrażenie listowe filtrujące tylko te wybiegi, które pasują do środowiska zwierzęcia
|
||||||
|
self.enclosures = [enclosure for enclosure in enclosures if enclosure.type == self.animal.environment]
|
||||||
|
|
||||||
def spawn_animal(self, blocked, taken):
|
def spawn_animal(self, blocked, taken):
|
||||||
possibilities = self.enclosures
|
enclosure = random.choice(self.enclosures)
|
||||||
fitting = []
|
|
||||||
for option in possibilities:
|
|
||||||
if option.type == self.animal.environment:
|
|
||||||
fitting.append(option)
|
|
||||||
enclosure = random.choice(fitting)
|
|
||||||
while True:
|
while True:
|
||||||
if enclosure.x1 < enclosure.x2:
|
if self.animal.adult:
|
||||||
self.animal.x = random.randint(enclosure.x1, enclosure.x2)
|
self.animal.x = random.randint(enclosure.x1+1, enclosure.x2-2)
|
||||||
if enclosure.y1 < enclosure.y2:
|
self.animal.y = random.randint(enclosure.y1+1, enclosure.y2-2)
|
||||||
self.animal.y = random.randint(enclosure.y1, enclosure.y2)
|
else:
|
||||||
if enclosure.y1 > enclosure.y2:
|
self.animal.x = random.randint(enclosure.x1+1, enclosure.x2)
|
||||||
self.animal.y = random.randint(enclosure.y2, enclosure.y1)
|
self.animal.y = random.randint(enclosure.y1+1, enclosure.y2)
|
||||||
if enclosure.x1 > enclosure.x2:
|
|
||||||
self.animal.x = random.randint(enclosure.x2, enclosure.x1)
|
|
||||||
if enclosure.y1 < enclosure.y2:
|
|
||||||
self.animal.y = random.randint(enclosure.y1, enclosure.y2)
|
|
||||||
if enclosure.y1 > enclosure.y2:
|
|
||||||
self.animal.y = random.randint(enclosure.y2, enclosure.y1)
|
|
||||||
if self.check(blocked, taken):
|
if self.check(blocked, taken):
|
||||||
break
|
break
|
||||||
|
|
||||||
def check(self, blocked, taken):
|
def check(self, blocked, taken):
|
||||||
x = self.animal.x
|
x = self.animal.x
|
||||||
y = self.animal.y
|
y = self.animal.y
|
||||||
|
|
||||||
if (x,y) in blocked or (x,y) in taken:
|
if (x,y) in blocked or (x,y) in taken:
|
||||||
return False
|
return False
|
||||||
taken.add((x,y))
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if self.animal.adult:
|
||||||
|
|
||||||
|
adult_fields = [(x, y), (x+1,y), (x,y+1), (x+1,y+1)] # Duże zwierze zajmuje 4 pola
|
||||||
|
|
||||||
|
if any(field in taken for field in adult_fields): # Jeśli stawiane zwierze jest dorosłe i jakiekolwiek pole jest zajęte, to nie można postawić zwierzęcia
|
||||||
|
return False
|
||||||
|
|
||||||
|
for field in adult_fields: # Dodaj wszystkie pola zajęte przez duże zwierzę
|
||||||
|
taken.add(field)
|
||||||
|
else:
|
||||||
|
taken.add((x,y))
|
||||||
|
|
||||||
|
return True
|
Loading…
Reference in New Issue
Block a user