From 10e61e724ca013f60a359d7afcbe5e246267df9e Mon Sep 17 00:00:00 2001 From: Angelika Iskra Date: Thu, 2 Jun 2022 00:52:16 +0200 Subject: [PATCH] setup genetic alg; --- algorithms/genetic/common.py | 69 ++++++++++++++++++ algorithms/genetic/const.py | 4 +- algorithms/genetic/genome.py | 69 +++++++++++++++++- algorithms/genetic/map_generator.py | 29 +++++--- algorithms/genetic/map_importer_exporter.py | 10 +-- algorithms/genetic/population.py | 81 +++++++++++++++++++++ algorithms/neural_network/__init__.py | 0 resources/maps/map_2022_05_31_00_41_36.json | 1 - resources/maps/map_2022_05_31_00_41_47.json | 1 - resources/maps/map_2022_05_31_00_41_51.json | 1 - resources/maps/map_2022_06_02_00_36_19.json | 1 + resources/maps/map_2022_06_02_00_38_31.json | 1 + resources/maps/map_2022_06_02_00_42_44.json | 1 + 13 files changed, 246 insertions(+), 22 deletions(-) create mode 100644 algorithms/neural_network/__init__.py delete mode 100644 resources/maps/map_2022_05_31_00_41_36.json delete mode 100644 resources/maps/map_2022_05_31_00_41_47.json delete mode 100644 resources/maps/map_2022_05_31_00_41_51.json create mode 100644 resources/maps/map_2022_06_02_00_36_19.json create mode 100644 resources/maps/map_2022_06_02_00_38_31.json create mode 100644 resources/maps/map_2022_06_02_00_42_44.json diff --git a/algorithms/genetic/common.py b/algorithms/genetic/common.py index e3f4cc5..49b0412 100644 --- a/algorithms/genetic/common.py +++ b/algorithms/genetic/common.py @@ -1,4 +1,7 @@ from dataclasses import dataclass + +import numpy as np + from const import * from typing import List, Dict, Tuple @@ -11,6 +14,56 @@ class Position: col: int +@dataclass +class Area: + position: Position + width: int + height: int + + +AREAS_TO_CROSS = [ + # up above left knights spawn + Area(position=Position(row=0, col=0), + width=KNIGHTS_SPAWN_WIDTH, + height=LEFT_KNIGHTS_SPAWN_FIRST_ROW), + + # down below left knights spawn + Area(position=Position(row=LEFT_KNIGHTS_SPAWN_FIRST_ROW + KNIGHTS_SPAWN_HEIGHT, col=0), + width=KNIGHTS_SPAWN_WIDTH, + height=ROWS - LEFT_KNIGHTS_SPAWN_FIRST_ROW - KNIGHTS_SPAWN_HEIGHT), + + # between left knights spawn and castle + Area(position=Position(row=0, col=KNIGHTS_SPAWN_WIDTH), + width=CASTLE_SPAWN_FIRST_COL - KNIGHTS_SPAWN_WIDTH, + height=ROWS), + + # up above castle + Area(position=Position(row=0, col=CASTLE_SPAWN_FIRST_COL), + width=2, + height=CASTLE_SPAWN_FIRST_ROW), + + # down below castle + Area(position=Position(row=CASTLE_SPAWN_FIRST_ROW + 2, col=CASTLE_SPAWN_FIRST_COL), + width=2, + height=ROWS - CASTLE_SPAWN_FIRST_ROW - 2), + + # between castle and right knights spawn + Area(position=Position(row=0, col=CASTLE_SPAWN_FIRST_COL + 2), + width=RIGHT_KNIGHTS_SPAWN_FIRST_COL - CASTLE_SPAWN_FIRST_COL - 2, + height=ROWS), + + # up above right knights spawn + Area(position=Position(row=0, col=RIGHT_KNIGHTS_SPAWN_FIRST_COL), + width=KNIGHTS_SPAWN_WIDTH, + height=RIGHT_KNIGHTS_SPAWN_FIRST_ROW), + + # down below right knights spawn + Area(position=Position(row=RIGHT_KNIGHTS_SPAWN_FIRST_ROW + KNIGHTS_SPAWN_HEIGHT, col=RIGHT_KNIGHTS_SPAWN_FIRST_COL), + width=KNIGHTS_SPAWN_WIDTH, + height=ROWS - RIGHT_KNIGHTS_SPAWN_FIRST_ROW - KNIGHTS_SPAWN_HEIGHT), +] + + def dfs(grid: npt.NDArray, visited: Dict[Tuple[int, int], bool], position: Position, rows: int, cols: int) -> None: visited[(position.row, position.col)] = True @@ -51,3 +104,19 @@ def get_islands(grid: npt.NDArray, positions: List[Position], rows: int = ROWS, islands += 1 return roots + + +def find_neighbours(grid: npt.NDArray, col: int, row: int) -> List[Position]: + dr = [-1, 1, 0, 0] + dc = [0, 0, -1, 1] + + neighbours = [] + + for i in range(4): + rr = row + dr[i] + cc = col + dc[i] + + if 0 <= rr < ROWS and 0 <= cc < COLUMNS and grid[rr][cc] == MAP_ALIASES.get('GRASS'): + neighbours.append(Position(row=rr, col=cc)) + + return neighbours diff --git a/algorithms/genetic/const.py b/algorithms/genetic/const.py index ac7d37a..61ff403 100644 --- a/algorithms/genetic/const.py +++ b/algorithms/genetic/const.py @@ -13,6 +13,8 @@ LEFT_KNIGHTS_SPAWN_FIRST_ROW = 6 LEFT_KNIGHTS_SPAWN_FIRST_COL = 0 RIGHT_KNIGHTS_SPAWN_FIRST_ROW = 6 RIGHT_KNIGHTS_SPAWN_FIRST_COL = 20 +CASTLE_SPAWN_FIRST_ROW = 7 +CASTLE_SPAWN_FIRST_COL = 11 # map aliases MAP_ALIASES = { @@ -24,4 +26,4 @@ MAP_ALIASES = { "CASTLE": 5, "KNIGHT_RED": 6, "KNIGHT_BLUE": 7, -} +} \ No newline at end of file diff --git a/algorithms/genetic/genome.py b/algorithms/genetic/genome.py index f060352..982b394 100644 --- a/algorithms/genetic/genome.py +++ b/algorithms/genetic/genome.py @@ -1,10 +1,13 @@ +import math +import random +from copy import deepcopy from random import randrange from typing import List import numpy as np import numpy.typing as npt -from common import Position +from common import Position, get_islands, AREAS_TO_CROSS, find_neighbours from const import * @@ -16,11 +19,15 @@ class Genome: trees: List[Position] sands: List[Position] monsters: List[Position] + fitness: int + sand_islands: List[Position] + tree_islands: List[Position] + water_islands: List[Position] def __init__(self): self.grid = np.zeros((ROWS, COLUMNS), dtype=int) + self.fitness = 0 - # todo: spawning castle, monsters, sand, trees in the same way as bellow self.knights_red = spawn_objects_in_given_area( grid=self.grid, object_alias=MAP_ALIASES.get("KNIGHT_RED"), @@ -43,7 +50,7 @@ class Genome: grid=self.grid, object_alias=MAP_ALIASES.get("CASTLE"), objects_count=4, - spawn_position_start=Position(row=7, col=9), + spawn_position_start=Position(row=CASTLE_SPAWN_FIRST_ROW, col=CASTLE_SPAWN_FIRST_COL), width=2, height=2 ) @@ -57,6 +64,62 @@ class Genome: self.monsters = spawn_objects_in_given_area(grid=self.grid, object_alias=MAP_ALIASES.get("MONSTER"), objects_count=MONSTERS_COUNT) + self.sand_islands = get_islands(self.grid, self.sands) + self.tree_islands = get_islands(self.grid, self.trees) + self.water_islands = get_islands(self.grid, self.waters) + + def calc_fitness(self): + score = SAND_COUNT + TREE_COUNT + WATER_COUNT + score = score - len(self.sand_islands) - len(self.tree_islands) - len(self.water_islands) + + # todo: odległość manhattan od każdej wyspy + + self.fitness = score + + def crossover(self, partner): + # replace a randomly selected part of the grid with partner's part + child = Genome() + child.grid = deepcopy(self.grid) + area_to_cross = random.choice(AREAS_TO_CROSS) + + for row in range(area_to_cross.position.row, area_to_cross.position.row + area_to_cross.height): + for col in range(area_to_cross.position.col, area_to_cross.position.col + area_to_cross.width): + child.grid[row][col] = partner.grid[row][col] + + child.sand_islands = get_islands(self.grid, self.sands) + child.tree_islands = get_islands(self.grid, self.trees) + child.water_islands = get_islands(self.grid, self.waters) + + return child + + def mutate(self, mutation_rate: float): + # remove 1 item from a random island and add a neighbor to another island + if random.random() < mutation_rate: + + # select islands of the same, random type + islands_of_same_type = random.choice([self.sand_islands, self.tree_islands, self.water_islands]) + random_index = random.randint(0, len(islands_of_same_type) - 1) + island = islands_of_same_type[random_index] + next_island = islands_of_same_type[(random_index + 1) % len(islands_of_same_type)] + + free_tiles_nearby = find_neighbours(self.grid, next_island.col, next_island.row) + + tile_type = self.grid[island.row][island.col] + + self.grid[island.row][island.col] = MAP_ALIASES.get('GRASS') + islands_of_same_type.remove(island) + + # todo: if there are no free tiles around then randomize another next_island + if len(free_tiles_nearby) > 0: + random_free_tile = random.choice(free_tiles_nearby) + island.row = random_free_tile.row + island.col = random_free_tile.col + self.grid[island.row][island.col] = tile_type + + self.sand_islands = get_islands(self.grid, self.sands) + self.tree_islands = get_islands(self.grid, self.trees) + self.water_islands = get_islands(self.grid, self.waters) + def is_empty(grid: npt.NDArray, position: Position) -> bool: return grid[position.row, position.col] in [MAP_ALIASES.get("GRASS"), MAP_ALIASES.get("SAND")] diff --git a/algorithms/genetic/map_generator.py b/algorithms/genetic/map_generator.py index abe85b9..0fe333a 100644 --- a/algorithms/genetic/map_generator.py +++ b/algorithms/genetic/map_generator.py @@ -1,16 +1,25 @@ -from map_importer_exporter import export_map -from genome import Genome -from common import get_islands +from algorithms.genetic.genome import Genome +from algorithms.genetic.map_importer_exporter import export_map +from population import Population def main() -> None: - example_genome = Genome() - print(example_genome.knights_red) - print(example_genome.knights_blue) - print(example_genome.grid) - islands = get_islands(example_genome.grid, example_genome.knights_red) - print(f'Roots {islands} and islands count {len(islands)}') - export_map(example_genome.grid) + population_size = 500 + mutation_rate = 0.4 + + population = Population(mutation_rate, population_size, 27) + + while not population.evaluate(): + # create next generation + population.generate() + + # calc fitness + population.calc_fitness() + + print(population.best_genome.grid) + print("Fitness of the best: ", population.best_genome.fitness) + + export_map(population.best_genome.grid) if __name__ == '__main__': diff --git a/algorithms/genetic/map_importer_exporter.py b/algorithms/genetic/map_importer_exporter.py index a3b5034..543c2ca 100644 --- a/algorithms/genetic/map_importer_exporter.py +++ b/algorithms/genetic/map_importer_exporter.py @@ -8,8 +8,6 @@ import numpy.typing as npt from os import listdir from os.path import isfile, join -MAPS_FOLDER = Path("resources/maps/") - # Save map to file def export_map(grid: npt.NDArray): @@ -17,9 +15,11 @@ def export_map(grid: npt.NDArray): now = datetime.now() file_name = "map_" + now.strftime("%Y_%m_%d_%H_%M_%S") + ".json" - file_to_open = MAPS_FOLDER / file_name + path = Path("../../resources/maps/") + file_to_open = path / file_name - with open(file_to_open, "w") as write_file: + print(file_to_open) + with open(file_to_open, "w+") as write_file: json.dump(json_data, write_file) print("Saved map to file " + file_name) @@ -33,7 +33,7 @@ def import_random_map() -> object: # Read map from file def import_map(file_name: string) -> object: - file_to_open = MAPS_FOLDER / file_name + file_to_open = "resources/maps/" + file_name with open(file_to_open, "r") as read_file: print("Reading map from file " + file_name) decoded_json = json.load(read_file) diff --git a/algorithms/genetic/population.py b/algorithms/genetic/population.py index e69de29..85ca8a4 100644 --- a/algorithms/genetic/population.py +++ b/algorithms/genetic/population.py @@ -0,0 +1,81 @@ +import random +from typing import List + +import numpy as np +import numpy.typing as npt + +from genome import Genome + + +class Population: + population: List[Genome] = [] # array to hold the current population + mating_pool: List[Genome] = [] # array which we will use for our "mating pool" + generations: int = 0 # number of generations + finished: bool = False # are we finished evolving? + mutation_rate: float + perfect_score: int + best_genome: Genome + + def __init__(self, mutation_rate, population_size, perfect_score=20): + self.mutation_rate = mutation_rate + self.perfect_score = perfect_score + + for i in range(0, population_size): + new_genome = Genome() + new_genome.calc_fitness() + self.population.append(new_genome) + + # create a new generation + def generate(self): + max_fitness = 0 + for genome in self.population: + if genome.fitness > max_fitness: + max_fitness = genome.fitness + + print("Max fitness of generation " + str(self.generations) + " = " + str(max_fitness)) + + # refill the population with children from the mating pool + new_population = [] + for genome in self.population: + partner_a = self.accept_reject(max_fitness) + partner_b = self.accept_reject(max_fitness) + child = partner_a.crossover(partner_b) + child.mutate(self.mutation_rate) + new_population.append(child) + + self.population = new_population + self.generations += 1 + + # select random with correct probability from population + def accept_reject(self, max_fitness: int): + safe_flag = 0 + + while safe_flag < 10000: + partner = random.choice(self.population) + r = random.randint(0, max_fitness) + + if r < partner.fitness: + return partner + + safe_flag += 1 + + # compute the current "most fit" member of the population + def evaluate(self): + record = 0 + best_index = 0 + + for index in range(len(self.population)): + genome = self.population[index] + if genome.fitness > record: + record = genome.fitness + best_index = index + + self.best_genome = self.population[best_index] + if record >= self.perfect_score: + self.finished = True + + return self.finished + + def calc_fitness(self): + for genome in self.population: + genome.calc_fitness() diff --git a/algorithms/neural_network/__init__.py b/algorithms/neural_network/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/resources/maps/map_2022_05_31_00_41_36.json b/resources/maps/map_2022_05_31_00_41_36.json deleted file mode 100644 index 9e72315..0000000 --- a/resources/maps/map_2022_05_31_00_41_36.json +++ /dev/null @@ -1 +0,0 @@ -{"map": [[0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 4, 2, 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, 0, 0, 3, 0], [1, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 2, 0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0], [0, 2, 2, 0, 3, 0, 0, 0, 0, 0, 0, 0, 3, 2, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]} \ No newline at end of file diff --git a/resources/maps/map_2022_05_31_00_41_47.json b/resources/maps/map_2022_05_31_00_41_47.json deleted file mode 100644 index f9c80cd..0000000 --- a/resources/maps/map_2022_05_31_00_41_47.json +++ /dev/null @@ -1 +0,0 @@ -{"map": [[0, 0, 0, 2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 3, 0, 0, 0, 3, 0, 0, 3, 0, 0], [0, 0, 0, 1, 0, 0, 0, 1, 0, 4, 0, 0, 0, 0, 2, 1, 2, 3, 0, 3, 0, 0, 0, 0], [3, 1, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0], [0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 3, 0, 0], [0, 6, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 3, 0, 0, 7, 7], [0, 0, 3, 2, 0, 0, 0, 0, 0, 5, 5, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 6, 0, 0, 0, 0, 1, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0], [0, 0, 6, 1, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 2, 2, 0, 0, 0, 3, 0, 7, 0], [0, 6, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 2, 0, 1, 0, 0, 0], [0, 3, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [3, 0, 0, 0, 0, 0, 0, 0, 3, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 7, 0, 0], [0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 3, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0], [0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 2, 0, 0, 3, 0, 0, 2, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 3, 3, 0, 3, 0, 0, 0, 0, 0, 0, 2, 0, 0, 3, 0, 0, 3, 0, 0, 0, 3, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]} \ No newline at end of file diff --git a/resources/maps/map_2022_05_31_00_41_51.json b/resources/maps/map_2022_05_31_00_41_51.json deleted file mode 100644 index 879f5fd..0000000 --- a/resources/maps/map_2022_05_31_00_41_51.json +++ /dev/null @@ -1 +0,0 @@ -{"map": [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 0], [1, 0, 0, 0, 0, 0, 0, 0, 1, 0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 0, 0, 0, 1, 4, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0], [0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]} \ No newline at end of file diff --git a/resources/maps/map_2022_06_02_00_36_19.json b/resources/maps/map_2022_06_02_00_36_19.json new file mode 100644 index 0000000..c377a12 --- /dev/null +++ b/resources/maps/map_2022_06_02_00_36_19.json @@ -0,0 +1 @@ +{"map": [[3, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 3, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 0, 0, 1, 1, 0], [2, 1, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 3, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 3, 3, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 0, 0, 2], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0], [0, 0, 6, 0, 1, 3, 0, 0, 0, 0, 0, 5, 5, 0, 0, 0, 3, 0, 0, 0, 0, 0, 7, 0], [0, 0, 0, 0, 0, 0, 3, 0, 1, 0, 1, 5, 5, 0, 0, 1, 0, 3, 0, 0, 3, 7, 0, 0], [0, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 6, 6, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0], [0, 0, 0, 1, 0, 0, 2, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 6, 0, 3, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 7, 0], [0, 0, 0, 0, 2, 3, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 2, 3, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 4, 0, 3, 0, 3, 0, 3, 3], [3, 1, 0, 1, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 3, 2, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 0, 2, 1, 1, 3, 0, 1, 0], [0, 0, 0, 0, 3, 3, 3, 0, 0, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1, 0, 0, 0, 0, 3, 3, 0, 0]]} \ No newline at end of file diff --git a/resources/maps/map_2022_06_02_00_38_31.json b/resources/maps/map_2022_06_02_00_38_31.json new file mode 100644 index 0000000..1f8bb43 --- /dev/null +++ b/resources/maps/map_2022_06_02_00_38_31.json @@ -0,0 +1 @@ +{"map": [[0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 2, 0, 3, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3], [2, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3], [3, 0, 0, 0, 3, 3, 0, 0, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0]]} \ No newline at end of file diff --git a/resources/maps/map_2022_06_02_00_42_44.json b/resources/maps/map_2022_06_02_00_42_44.json new file mode 100644 index 0000000..b17c72d --- /dev/null +++ b/resources/maps/map_2022_06_02_00_42_44.json @@ -0,0 +1 @@ +{"map": [[0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2, 0, 0, 0, 0, 0, 2, 3, 0, 0, 0, 0], [0, 0, 0, 0, 0, 6, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 3, 0], [0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0], [2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 3, 0, 1], [0, 0, 0, 6, 0, 0, 0, 6, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 3, 5, 5, 0, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 6, 3, 0, 0, 0, 0, 0, 0, 5, 5, 3, 2, 0, 0, 0, 0, 0, 0, 0, 7, 7], [3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0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