Skip to content

Commit

Permalink
Files: removing comments from the python script.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuno-Jesus committed Feb 6, 2023
1 parent c68a4c7 commit ddd73fb
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,14 @@
from colorama import Style
from colorama import Fore

# COLOR MACROS
RESET = Style.RESET_ALL
LRED = Fore.LIGHTRED_EX
LYELLOW = Fore.LIGHTYELLOW_EX
LBLUE = Fore.LIGHTBLUE_EX
LGREEN = Fore.LIGHTGREEN_EX

"""
While the x and y are not valid:
Ask for the x and y
First check if the filename used already exists
If yes :
Increment the number of the generated file
Else:
Create a new file called "map{N}.ber"
Apply the dimensions to a newly created map
"""

# OTHER MACROS
ENTITIES = "01C"
GEN_PATH = "maps/generated"

Expand Down Expand Up @@ -52,14 +39,12 @@ def generate_map(filename, x, y) -> None:
ey = random.randint(1, y - 2)
ex = random.randint(1, x - 2)

#print(f'Player (Y/X): ({py}/{px})')
#print(f'Exit (Y/X): ({ey}/{ex})')
contents[py][px] = 'P'
contents[ey][ex] = 'E'

f = open(filename, "x")
for line in contents:
print("".join(line), end ='')
print("".join(line), end = '')
f.write("".join(line))
f.close()
print(f'The map was saved in {LRED}{filename}{RESET}.')
Expand All @@ -82,7 +67,7 @@ def generate_file() -> str:
x = int(input(f'Width: '))
y = int(input(f'Height: '))
except ValueError:
print(f'\n\t===== {LRED}INPUT MUST BE A POSITIVE INT{RESET} =====\n')
print(f'\n\t===== {LRED}INPUT MUST BE BIGGER THAN 3{RESET} =====\n')

random.seed()
generate_map(generate_file(), x, y)
Expand Down

0 comments on commit ddd73fb

Please sign in to comment.