From bbad16684922f0cff926b3da984f40bf5081da1d Mon Sep 17 00:00:00 2001 From: Nuno Jesus Date: Mon, 6 Feb 2023 17:51:19 +0000 Subject: [PATCH 1/7] Code: separated exit, player and coin generation in different functions. --- generator.py | 48 ++++++++++++++++++++++++----------------- maps/generated/map3.ber | 10 +++++++++ maps/generated/map4.ber | 10 +++++++++ maps/generated/map5.ber | 10 +++++++++ maps/generated/map6.ber | 10 +++++++++ maps/generated/map7.ber | 10 +++++++++ 6 files changed, 78 insertions(+), 20 deletions(-) create mode 100644 maps/generated/map3.ber create mode 100644 maps/generated/map4.ber create mode 100644 maps/generated/map5.ber create mode 100644 maps/generated/map6.ber create mode 100644 maps/generated/map7.ber diff --git a/generator.py b/generator.py index a069914..836937e 100644 --- a/generator.py +++ b/generator.py @@ -11,28 +11,20 @@ LGREEN = Fore.LIGHTGREEN_EX # OTHER MACROS -ENTITIES = "01C" GEN_PATH = "maps/generated" -def generate_entity() -> str: - n = random.randint(1, 100) +def generate_coins(contents, x, y) -> None: + num_coins = random.randint(0, 15) + print(f"Num coins: {num_coins}") - if n in range(1, 70): - return '0' - elif n in range(71, 95): - return '1' - else: - return 'C' - - -def generate_map(filename, x, y) -> None: - contents = [] - - contents.append(['1' for _ in range(0, x)] + ['\n']) - for _ in range(0, y - 2): - contents.append(['1'] + [generate_entity() for _ in range(0, x - 2)] + ['1', '\n']) - contents.append(['1' for _ in range(0, x)] + ['\n']) + for i in range(0, num_coins): + cy = random.randint(1, y - 2) + cx = random.randint(1, x - 2) + + if contents[cy][cx] == '0': + contents[cy][cx] = 'C' +def generate_player_and_exit(contents, x, y) -> None: py = random.randint(1, y - 2) px = random.randint(1, x - 2) @@ -42,6 +34,21 @@ def generate_map(filename, x, y) -> None: contents[py][px] = 'P' contents[ey][ex] = 'E' +def generate_walls(content, x, y): + pass + +def generate_map(filename, x, y) -> None: + contents = [] + + contents.append(['1' for _ in range(0, x)] + ['\n']) + for _ in range(0, y - 2): + contents.append(['1'] + list((y - 2) * "0") + ['1', '\n']) + contents.append(['1' for _ in range(0, x)] + ['\n']) + + generate_player_and_exit(contents, x, y) + generate_coins(contents, x, y) + generate_walls(contents, x, y) + f = open(filename, "x") for line in contents: print("".join(line), end = '') @@ -50,6 +57,7 @@ def generate_map(filename, x, y) -> None: print(f'The map was saved in {LRED}{filename}{RESET}.') + def generate_file() -> str: n = 1 @@ -62,12 +70,12 @@ def generate_file() -> str: x = -1 y = -1 - while y < 0 or x < 0: + while y < 3 or x < 3: try: x = int(input(f'Width: ')) y = int(input(f'Height: ')) except ValueError: - print(f'\n\t===== {LRED}INPUT MUST BE BIGGER THAN 3{RESET} =====\n') + print(f'\n\t===== {LRED}INPUT MUST BE BIGGER THAN 2{RESET} =====\n') random.seed() generate_map(generate_file(), x, y) diff --git a/maps/generated/map3.ber b/maps/generated/map3.ber new file mode 100644 index 0000000..b13447c --- /dev/null +++ b/maps/generated/map3.ber @@ -0,0 +1,10 @@ +1111111111 +1000000001 +1000000001 +1000000001 +1000000001 +100P000001 +1000000001 +1E00000001 +1000000001 +1111111111 diff --git a/maps/generated/map4.ber b/maps/generated/map4.ber new file mode 100644 index 0000000..ce75301 --- /dev/null +++ b/maps/generated/map4.ber @@ -0,0 +1,10 @@ +1111111111 +1000000001 +100E000001 +1000000001 +100000P001 +1000000001 +1000000001 +1000000001 +1000000001 +1111111111 diff --git a/maps/generated/map5.ber b/maps/generated/map5.ber new file mode 100644 index 0000000..d9ba549 --- /dev/null +++ b/maps/generated/map5.ber @@ -0,0 +1,10 @@ +1111111111 +1000000001 +1000000001 +1000000001 +1000000001 +100E000001 +1000000P01 +1000000001 +1000000001 +1111111111 diff --git a/maps/generated/map6.ber b/maps/generated/map6.ber new file mode 100644 index 0000000..32bfaf6 --- /dev/null +++ b/maps/generated/map6.ber @@ -0,0 +1,10 @@ +1111111111 +1P00C00001 +1CC0000C01 +1000000001 +1C00000001 +1000000CE1 +100C000001 +1000000C01 +10000C0C01 +1111111111 diff --git a/maps/generated/map7.ber b/maps/generated/map7.ber new file mode 100644 index 0000000..a593da1 --- /dev/null +++ b/maps/generated/map7.ber @@ -0,0 +1,10 @@ +1111111111 +10C0CCC001 +1000000C01 +1C0C000EC1 +1000000C01 +1000000001 +1C00000001 +10P0000001 +100C000CC1 +1111111111 From e7af815bfd2478131939e66399abb2a6678485ba Mon Sep 17 00:00:00 2001 From: Nuno Jesus Date: Tue, 7 Feb 2023 09:39:30 +0000 Subject: [PATCH 2/7] Hotfix: added quotes to the grep command in the if condition to prevent the command expansion from failing the if condition. --- tester.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tester.sh b/tester.sh index ab2d6cc..fa0e2bf 100644 --- a/tester.sh +++ b/tester.sh @@ -48,8 +48,8 @@ do echo "\n\t--------------------- TEST $i ---------------------\n" >> $LOGFILE echo -n "File: \"$test_file\" " >> $LOGFILE $1/so_long $TESTS/$test_file > $TEMPFILE 2>&1 - - if [ $(grep Error $TEMPFILE) ]; then + + if [ "$(grep Error $TEMPFILE)" ]; then echo -n "$GREEN"OK"$RESET " && echo ✅ >> $LOGFILE echo "-------- START OF OUTPUT --------" >> $LOGFILE cat -e $TEMPFILE >> $LOGFILE From 7ed575533c2354d3c20d4ee01e17a988c1db5164 Mon Sep 17 00:00:00 2001 From: Nuno Jesus Date: Tue, 7 Feb 2023 12:16:06 +0000 Subject: [PATCH 3/7] Makefile: small terminal display change. --- Makefile | 4 ++-- maps/generated/map1.ber | 4 ---- maps/generated/map2.ber | 6 ------ maps/generated/map3.ber | 10 ---------- maps/generated/map4.ber | 10 ---------- maps/generated/map5.ber | 10 ---------- maps/generated/map6.ber | 10 ---------- maps/generated/map7.ber | 10 ---------- 8 files changed, 2 insertions(+), 62 deletions(-) delete mode 100644 maps/generated/map1.ber delete mode 100644 maps/generated/map2.ber delete mode 100644 maps/generated/map3.ber delete mode 100644 maps/generated/map4.ber delete mode 100644 maps/generated/map5.ber delete mode 100644 maps/generated/map6.ber delete mode 100644 maps/generated/map7.ber diff --git a/Makefile b/Makefile index 4a507c6..04a6c9d 100644 --- a/Makefile +++ b/Makefile @@ -16,13 +16,13 @@ PY = python3 -B MKFLAGS = --no-print-directory #_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_ FOLDERS _/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_ -PROJ = ../so_long +PROJ = ../andreia #_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_ RULES _/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_ all: setup setup: - echo "Checking for updates" + echo "[$(CYAN) Git $(RESET)] Checking for updates..." git pull origin main sh tester.sh $(PROJ) diff --git a/maps/generated/map1.ber b/maps/generated/map1.ber deleted file mode 100644 index 05fe2e0..0000000 --- a/maps/generated/map1.ber +++ /dev/null @@ -1,4 +0,0 @@ -1111111 -11E0011 -1P00001 -1111111 diff --git a/maps/generated/map2.ber b/maps/generated/map2.ber deleted file mode 100644 index d3d19ef..0000000 --- a/maps/generated/map2.ber +++ /dev/null @@ -1,6 +0,0 @@ -111111111111111111111111111111 -100001C00000000101000001001001 -1000000P00000C0001C110CC000111 -1011100100010001001C1001000001 -10100E00000110C00C000100000C01 -111111111111111111111111111111 diff --git a/maps/generated/map3.ber b/maps/generated/map3.ber deleted file mode 100644 index b13447c..0000000 --- a/maps/generated/map3.ber +++ /dev/null @@ -1,10 +0,0 @@ -1111111111 -1000000001 -1000000001 -1000000001 -1000000001 -100P000001 -1000000001 -1E00000001 -1000000001 -1111111111 diff --git a/maps/generated/map4.ber b/maps/generated/map4.ber deleted file mode 100644 index ce75301..0000000 --- a/maps/generated/map4.ber +++ /dev/null @@ -1,10 +0,0 @@ -1111111111 -1000000001 -100E000001 -1000000001 -100000P001 -1000000001 -1000000001 -1000000001 -1000000001 -1111111111 diff --git a/maps/generated/map5.ber b/maps/generated/map5.ber deleted file mode 100644 index d9ba549..0000000 --- a/maps/generated/map5.ber +++ /dev/null @@ -1,10 +0,0 @@ -1111111111 -1000000001 -1000000001 -1000000001 -1000000001 -100E000001 -1000000P01 -1000000001 -1000000001 -1111111111 diff --git a/maps/generated/map6.ber b/maps/generated/map6.ber deleted file mode 100644 index 32bfaf6..0000000 --- a/maps/generated/map6.ber +++ /dev/null @@ -1,10 +0,0 @@ -1111111111 -1P00C00001 -1CC0000C01 -1000000001 -1C00000001 -1000000CE1 -100C000001 -1000000C01 -10000C0C01 -1111111111 diff --git a/maps/generated/map7.ber b/maps/generated/map7.ber deleted file mode 100644 index a593da1..0000000 --- a/maps/generated/map7.ber +++ /dev/null @@ -1,10 +0,0 @@ -1111111111 -10C0CCC001 -1000000C01 -1C0C000EC1 -1000000C01 -1000000001 -1C00000001 -10P0000001 -100C000CC1 -1111111111 From b1cc5ae5f33ad03070f36450a12b0597e756c4dd Mon Sep 17 00:00:00 2001 From: Nuno Jesus Date: Tue, 7 Feb 2023 15:15:54 +0000 Subject: [PATCH 4/7] Code: recovering from the stash the code from to fill with walls. --- Makefile | 2 +- generator.py | 46 ++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 04a6c9d..baa09c5 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ all: setup setup: echo "[$(CYAN) Git $(RESET)] Checking for updates..." - git pull origin main + # git pull origin main sh tester.sh $(PROJ) clean: diff --git a/generator.py b/generator.py index 836937e..8644219 100644 --- a/generator.py +++ b/generator.py @@ -12,6 +12,10 @@ # OTHER MACROS GEN_PATH = "maps/generated" +WALL_PROBABILITY = 0.80 +HORIZONTAL = 0 +VERTICAL = 1 +DIRECTIONS = [HORIZONTAL, VERTICAL] def generate_coins(contents, x, y) -> None: num_coins = random.randint(0, 15) @@ -21,6 +25,7 @@ def generate_coins(contents, x, y) -> None: cy = random.randint(1, y - 2) cx = random.randint(1, x - 2) + print(f"Coin (X/Y): {[cx, cy]}") if contents[cy][cx] == '0': contents[cy][cx] = 'C' @@ -28,23 +33,56 @@ def generate_player_and_exit(contents, x, y) -> None: py = random.randint(1, y - 2) px = random.randint(1, x - 2) + print(f"Player (X/Y): {[px, py]}") ey = random.randint(1, y - 2) ex = random.randint(1, x - 2) + print(f"Exit (X/Y): {[ex, ey]}") contents[py][px] = 'P' contents[ey][ex] = 'E' -def generate_walls(content, x, y): - pass + +def flood_fill(contents, point, dims, prob): + if contents[point[1]][point[0]] != '0' or \ + point[1] not in range(0, dims[1] - 1) or \ + point[0] not in range(0, dims[0] - 1): + return + + n = random.randint(1, 100) + if n in range(0, 100 - prob): + contents[point[1]][point[0]] = '1' + return + flood_fill(contents, [point[0] - 1, point[1]], dims, int(prob * WALL_PROBABILITY)) #L + flood_fill(contents, [point[0] + 1, point[1]], dims, int(prob * WALL_PROBABILITY)) #R + flood_fill(contents, [point[0], point[1] - 1], dims, int(prob * WALL_PROBABILITY)) #U + flood_fill(contents, [point[0], point[1] + 1], dims, int(prob * WALL_PROBABILITY)) #D + +def draw_walls(contents, point, len, dims): + for i in range(point[0], min(point[0] + len, dims[0] - 1)): + contents[point[1]][point[0] + i] = '1' + +def generate_walls(contents, x, y): + num_points = random.randint(1, max(x, y) / 2) + + for i in range(0, num_points): + px = random.randint(1, x - 2) + py = random.randint(1, y - 2) + print(f"Point (X/Y): {[px, py]}") + len = random.randint(1, x - 2) + draw_walls(contents, [px, py], len, [x, y]) + #flood_fill(contents, [px, py], [x, y], 100) def generate_map(filename, x, y) -> None: contents = [] contents.append(['1' for _ in range(0, x)] + ['\n']) for _ in range(0, y - 2): - contents.append(['1'] + list((y - 2) * "0") + ['1', '\n']) + contents.append(['1'] + list((x - 2) * "0") + ['1', '\n']) contents.append(['1' for _ in range(0, x)] + ['\n']) + for line in contents: + print("".join(line), end ="") + generate_player_and_exit(contents, x, y) generate_coins(contents, x, y) generate_walls(contents, x, y) @@ -57,7 +95,6 @@ def generate_map(filename, x, y) -> None: print(f'The map was saved in {LRED}{filename}{RESET}.') - def generate_file() -> str: n = 1 @@ -77,6 +114,7 @@ def generate_file() -> str: except ValueError: print(f'\n\t===== {LRED}INPUT MUST BE BIGGER THAN 2{RESET} =====\n') + print(f'Dims (x/y): {[x, y]}') random.seed() generate_map(generate_file(), x, y) \ No newline at end of file From 96810fc2f079c3545a2fe9b265cb052e8c5baa88 Mon Sep 17 00:00:00 2001 From: Nuno Jesus Date: Tue, 7 Feb 2023 19:40:58 +0000 Subject: [PATCH 5/7] Code: changed how the walls in a map are generated, not using flood_fill. --- generator.py | 52 ++++++++++++++++++++++++++++++++++----------------- output.log | Bin 0 -> 2003 bytes temp | Bin 0 -> 61 bytes 3 files changed, 35 insertions(+), 17 deletions(-) create mode 100644 output.log create mode 100644 temp diff --git a/generator.py b/generator.py index 8644219..8aa64a2 100644 --- a/generator.py +++ b/generator.py @@ -13,12 +13,13 @@ # OTHER MACROS GEN_PATH = "maps/generated" WALL_PROBABILITY = 0.80 +COIN_PROBABILITY = 0.80 HORIZONTAL = 0 VERTICAL = 1 DIRECTIONS = [HORIZONTAL, VERTICAL] def generate_coins(contents, x, y) -> None: - num_coins = random.randint(0, 15) + num_coins = random.randint(0, max(x, y) * COIN_PROBABILITY) print(f"Num coins: {num_coins}") for i in range(0, num_coins): @@ -42,6 +43,7 @@ def generate_player_and_exit(contents, x, y) -> None: contents[ey][ex] = 'E' +""" def flood_fill(contents, point, dims, prob): if contents[point[1]][point[0]] != '0' or \ point[1] not in range(0, dims[1] - 1) or \ @@ -58,9 +60,9 @@ def flood_fill(contents, point, dims, prob): flood_fill(contents, [point[0], point[1] + 1], dims, int(prob * WALL_PROBABILITY)) #D def draw_walls(contents, point, len, dims): - for i in range(point[0], min(point[0] + len, dims[0] - 1)): + stop = min(point[0] + len, dims[0] - 1) + for i in range(point[0], stop): contents[point[1]][point[0] + i] = '1' - def generate_walls(contents, x, y): num_points = random.randint(1, max(x, y) / 2) @@ -71,6 +73,28 @@ def generate_walls(contents, x, y): len = random.randint(1, x - 2) draw_walls(contents, [px, py], len, [x, y]) #flood_fill(contents, [px, py], [x, y], 100) +""" + +def generate_walls(contents, x, y): + for line in contents[2::2]: + px = random.randint(0, x - 1) + width = random.randint(0, x - 1) + + print(f'{line} -> x = {px} width = {width}') + i = 0 + for i in range (0, x - 1): + if line[i] == '0' and i in range(px, px + width): + line[i] = '1' + i += 1 + + for i in range(0, x - 1, 3): + py = random.randint(0, y - 1) + width = random.randint(0, y - 1) + + print(f'col -> y = {py} width = {width}') + for k in range (0, y - 1): + if contents[k][i] == '0' and k in range(py, py + width): + contents[k][i] = '1' def generate_map(filename, x, y) -> None: contents = [] @@ -94,18 +118,9 @@ def generate_map(filename, x, y) -> None: f.close() print(f'The map was saved in {LRED}{filename}{RESET}.') - -def generate_file() -> str: - n = 1 - - while os.path.exists(f'{GEN_PATH}/map{n}.ber'): - n += 1 - - return (f'{GEN_PATH}/map{n}.ber') - if __name__ == "__main__" : - x = -1 - y = -1 + n = 1 + x, y = -1, -1 while y < 3 or x < 3: try: @@ -113,8 +128,11 @@ def generate_file() -> str: y = int(input(f'Height: ')) except ValueError: print(f'\n\t===== {LRED}INPUT MUST BE BIGGER THAN 2{RESET} =====\n') - + + while os.path.exists(f'{GEN_PATH}/map{n}.ber'): + n += 1 + + random.seed() print(f'Dims (x/y): {[x, y]}') - random.seed() - generate_map(generate_file(), x, y) + generate_map(f'{GEN_PATH}/map{n}.ber', x, y) \ No newline at end of file diff --git a/output.log b/output.log new file mode 100644 index 0000000000000000000000000000000000000000..cbec8a5d220c033ea954b771ecf5fd0703c342b7 GIT binary patch literal 2003 zcmcJQ|4!R55XblL@)RfjDM-!FcEB>_j|v5*2{u#;+ax69CfC-&i6h$?RN@i#3VXRd z$?UYl?bdeuTK-7S_TBf+cORvGl3cp}(_hYAlH9=)9}~MtfY++3mB;vaO@cK7gBk($ z;1GupzKy#<97OOr9Y7RBon@sp0?SUDR*k@AlKAd3UXJtHUG=~qJsUs>tIk}d`Qy8jB>TZ`kR)(|MK;0gx(x&hEV!5g3c&^Bs4!DpSl0ty zO$8lK6l@>t=zax}8wKH>jx2LH`gjgUr^l_l4Z|sXs2L?CoZ$@-IiLcErICWic3j{3~jKr4t3WVl}Z91 z&1ujIX4bN3W%~QxPQYcDIOv%hkS18FyRme>&P)N(nN!3#b0rEgBpirekUVe!} LYDH#oi5?dKf)^C6 literal 0 HcmV?d00001 From 468bfd44c9a6a8aa3e335b61869b8115f45735a8 Mon Sep 17 00:00:00 2001 From: Nuno Jesus Date: Tue, 7 Feb 2023 19:54:04 +0000 Subject: [PATCH 6/7] Files: removing temporary files. --- output.log | Bin 2003 -> 0 bytes temp | Bin 61 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 output.log delete mode 100644 temp diff --git a/output.log b/output.log deleted file mode 100644 index cbec8a5d220c033ea954b771ecf5fd0703c342b7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2003 zcmcJQ|4!R55XblL@)RfjDM-!FcEB>_j|v5*2{u#;+ax69CfC-&i6h$?RN@i#3VXRd z$?UYl?bdeuTK-7S_TBf+cORvGl3cp}(_hYAlH9=)9}~MtfY++3mB;vaO@cK7gBk($ z;1GupzKy#<97OOr9Y7RBon@sp0?SUDR*k@AlKAd3UXJtHUG=~qJsUs>tIk}d`Qy8jB>TZ`kR)(|MK;0gx(x&hEV!5g3c&^Bs4!DpSl0ty zO$8lK6l@>t=zax}8wKH>jx2LH`gjgUr^l_l4Z|sXs2L?CoZ$@-IiLcErICWic3j{3~jKr4t3WVl}Z91 z&1ujIX4bN3W%~QxPQYcDIOv%hkS18FyRme>&P)N(nN!3#b0rEgBpirekUVe!} LYDH#oi5?dKf)^C6 From 257a69fa4ca196113d1993008354223356920949 Mon Sep 17 00:00:00 2001 From: Nuno Jesus Date: Tue, 7 Feb 2023 21:03:30 +0000 Subject: [PATCH 7/7] Code: commenting code. --- generator.py | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/generator.py b/generator.py index 8aa64a2..dc1643a 100644 --- a/generator.py +++ b/generator.py @@ -26,7 +26,7 @@ def generate_coins(contents, x, y) -> None: cy = random.randint(1, y - 2) cx = random.randint(1, x - 2) - print(f"Coin (X/Y): {[cx, cy]}") + #print(f"Coin (X/Y): {[cx, cy]}") if contents[cy][cx] == '0': contents[cy][cx] = 'C' @@ -42,8 +42,6 @@ def generate_player_and_exit(contents, x, y) -> None: contents[py][px] = 'P' contents[ey][ex] = 'E' - -""" def flood_fill(contents, point, dims, prob): if contents[point[1]][point[0]] != '0' or \ point[1] not in range(0, dims[1] - 1) or \ @@ -59,28 +57,12 @@ def flood_fill(contents, point, dims, prob): flood_fill(contents, [point[0], point[1] - 1], dims, int(prob * WALL_PROBABILITY)) #U flood_fill(contents, [point[0], point[1] + 1], dims, int(prob * WALL_PROBABILITY)) #D -def draw_walls(contents, point, len, dims): - stop = min(point[0] + len, dims[0] - 1) - for i in range(point[0], stop): - contents[point[1]][point[0] + i] = '1' -def generate_walls(contents, x, y): - num_points = random.randint(1, max(x, y) / 2) - - for i in range(0, num_points): - px = random.randint(1, x - 2) - py = random.randint(1, y - 2) - print(f"Point (X/Y): {[px, py]}") - len = random.randint(1, x - 2) - draw_walls(contents, [px, py], len, [x, y]) - #flood_fill(contents, [px, py], [x, y], 100) -""" - def generate_walls(contents, x, y): for line in contents[2::2]: px = random.randint(0, x - 1) width = random.randint(0, x - 1) - print(f'{line} -> x = {px} width = {width}') + #print(f'{line} -> x = {px} width = {width}') i = 0 for i in range (0, x - 1): if line[i] == '0' and i in range(px, px + width): @@ -91,10 +73,13 @@ def generate_walls(contents, x, y): py = random.randint(0, y - 1) width = random.randint(0, y - 1) - print(f'col -> y = {py} width = {width}') + #print(f'col -> y = {py} width = {width}') for k in range (0, y - 1): if contents[k][i] == '0' and k in range(py, py + width): contents[k][i] = '1' + + #flood_fill(contents, [px, py], [x, y], 100) + def generate_map(filename, x, y) -> None: contents = [] @@ -104,9 +89,6 @@ def generate_map(filename, x, y) -> None: contents.append(['1'] + list((x - 2) * "0") + ['1', '\n']) contents.append(['1' for _ in range(0, x)] + ['\n']) - for line in contents: - print("".join(line), end ="") - generate_player_and_exit(contents, x, y) generate_coins(contents, x, y) generate_walls(contents, x, y) @@ -133,6 +115,5 @@ def generate_map(filename, x, y) -> None: n += 1 random.seed() - print(f'Dims (x/y): {[x, y]}') generate_map(f'{GEN_PATH}/map{n}.ber', x, y) \ No newline at end of file