More tidying up + minor bug fix on saving maze

This commit is contained in:
adithyagenie 2022-11-05 12:07:23 +05:30
parent e05ea8cdaa
commit c8264cf347
3 changed files with 26 additions and 12 deletions

View file

@ -12,9 +12,9 @@ def about(screen):
5,
"This game which you have played was developed as a Computer Science Project by",
)
screen.addstr(5, 5, "B. Adithya - XII - C - Roll no: 3")
screen.addstr(6, 5, "V. Kirthivaasan - XII - C - Roll no: 17")
screen.addstr(7, 5, "Manwanthakrishnan - XII - C - Roll no: 21")
screen.addstr(5, 5, "B. Adithya\t\t\t - XII - C - Roll no: 3")
screen.addstr(6, 5, "V. Kirthivaasan\t\t - XII - C - Roll no: 17")
screen.addstr(7, 5, "R. Manwanthakrishnan\t - XII - C - Roll no: 21")
screen.addstr(
9,
5,
@ -26,22 +26,28 @@ def about(screen):
screen.addstr(
11,
5,
"This game makes use of the 'curses' module which runs on any operating system",
"This game makes use of the 'curses' module which runs on any operating system in the native terminal without"
)
screen.addstr(
12, 5, "in the native terminal without use of any other external modules."
12, 5,
"use of any other external modules."
)
screen.addstr(
13,
5,
"It makes use of SQL tables to store login details and maintain a leaderboard.",
)
screen.addstr(15, 5, "This project has been an absolute blast to make.")
screen.addstr(
16, 5, "We thank you for playing this! Hope you liked it as much as we did!"
14,
5,
"It also makes use of binary files to save and load mazes.",
)
screen.addstr(19, 5, "Signing off,")
screen.addstr(20, 5, "The Labyrinth")
screen.addstr(16, 5, "This project has been an absolute blast to make.")
screen.addstr(
17, 5, "We thank you for playing this! Hope you liked it as much as we did!"
)
screen.addstr(20, 5, "Signing off,")
screen.addstr(21, 5, "The Labyrinth")
screen.addstr(y - 2, x - 33, "Press Enter to exit this screen.")
screen.refresh()
while True:

View file

@ -532,13 +532,15 @@ def main(screen):
curses.init_pair(3, curses.COLOR_RED, curses.COLOR_BLACK)
screen.clear()
screen.refresh()
height, width = screen.getmaxyx()
height, width = int((height - 2) / 2), int((width - 2) / 2)
y, x = screen.getmaxyx()
height, width = int((y - 2) / 2), int((x - 2) / 2)
database.databaseinit()
database.tableinit()
maze = Maze(height, width)
screen.addstr(0, 0, str(maze))
screen.refresh()
screen.addstr(2, x - 22, "Press space to skip")
screen.addstr(3, x - 22, "the loading screen...")
construction_demo(maze, screen)
screen.clear()
screen.refresh() # 70x 15y

View file

@ -15,7 +15,13 @@ def save(screen, maze, coords):
screen.addstr(17, x - 17, "Enter filename: ")
name = input(18, x - 17, screen)
if names:
num = int(((names[-1].replace(".maze", "")).split("_"))[1]) + 1
for i in range(len(names)):
names[i] = names[i].replace(".maze", "")
for i in range(len(names)):
for j in range(len(names) - i - 1):
if int(names[j].split('_')[1]) > int(names[j + 1].split('_')[1]):
names[j], names[j + 1] = names[j + 1], names[j]
num = int(names[-1].split('_')[1]) + 1
if not name:
name = "default"
filename = f"maze_{str(num)}_{name}.maze"