Skip to content

Commit 29684e3

Browse files
authored
Merge pull request #50 from gabriel-lau/Play-maze
Additional bug fixes for play maze feature
2 parents c1b0be9 + f82853c commit 29684e3

10 files changed

+9
-8
lines changed

.coverage

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
!coverage.py: This is a private format, don't read it directly!{"lines":{"C:\\Study stuff\\ETI\\Project_Kavala\\test_configure_maze.py":[1,2,3,4,6,7,8,9,10,12,13,15,16,18,19,21,22,25,29,33,40,45,50,55,60,66,71,76,82,87,92,97,102,107,112,119,123,128,26,30,34,37,41,42,46,47,51,52,56,57,61,63,67,68,72,73,77,79,83,84,88,89,98,99,103,104,113,114,120,124,129],"C:\\Study stuff\\ETI\\Project_Kavala\\SRC\\Main.py":[1,2,5,18,41,60,72,77,107,129,140,150,160,168,180,216,228,242,254,268,280,293,301,319,109,117,125,126,110,113,131,132,134,137,142,143,146,151,152,155,161,162,165,169,170,171,181,183,172,173,174,175,176,177,229,231,232,234,302,303,304,235,238,305,306,307,239,217,218,219,220,221,222,223,224,225,308,309,310,243,244,245,255,256,258,246,247,248,249,250,251,257,269,270,271,281,282,284,285,286,288,289,290,272,273,274,275,276,277,283,294,295,296,298,311,312,313,61,64,65,66,68,62,6,13,14,320,321,322,323,325,326,328,331,333,335,337,338,339,19,20,21,23,24,25,26,27,29,30,42,43,44,47,45,46,48,49,50,51,55,56,31,38,33,52,53],"C:\\Study stuff\\ETI\\Project_Kavala\\test_display_maze.py":[1,2,3,4,6,7,11,14,12,15,16,17],"C:\\Study stuff\\ETI\\Project_Kavala\\test_menu.py":[1,2,3,4,6,7,11,26,12,13,27,28],"C:\\Study stuff\\ETI\\Project_Kavala\\test_read_maze.py":[1,2,3,4,6,7,11,15,19,23,28,12,13,16,17,20,21,24,25,26,29,30]}}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
*.pyc

SRC/Main.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,15 @@ def play_game(maze_list): #Load Maze
105105
print('\n''Location of Start (A) = ' + '(Row ' + str(row_A) + ', Column ' + str(column_A) +')') # Printing out location
106106
print('\n''Location of Start (B) = ' + '(Row ' + str(row_B) + ', Column ' + str(column_B) +')')
107107

108-
movement = input(str('\n'"Press 'W' for UP, 'A' for LEFT, 'S' for DOWN, 'D' for RIGHT, 'M' for MAIN MENU: ")) # Movement code
108+
movement = input(str('\n'"Press 'W' for UP, 'A' for LEFT, 'S' for DOWN, 'D' for RIGHT, 'M' for MAIN MENU: ")).upper() # Movement code
109109
start_coords = (row_A,column_A)
110110

111111
if movement == 'M':
112112
return main(maze_list)
113113
elif movement == 'W':
114114
if maze_list[start_coords[0]-1][start_coords[1]] == 'B': # Check if it is the end
115115
print("Congrats!")
116-
quit()
116+
return main(maze_list)
117117
if maze_list[start_coords[0]-1][start_coords[1]] == 'O' or maze_list[start_coords[0]-1][start_coords[1]] == 'B':# Check if it is valid move
118118
maze_list[start_coords[0]][start_coords[1]] = 'O'
119119
maze_list[start_coords[0]-1][start_coords[1]] = 'A'
@@ -123,7 +123,7 @@ def play_game(maze_list): #Load Maze
123123
elif movement == 'A':
124124
if maze_list[start_coords[0]][start_coords[1]-1] == 'B':
125125
print("Congrats!")
126-
quit()
126+
return main(maze_list)
127127
if maze_list[start_coords[0]][start_coords[1]-1] == 'O' or maze_list[start_coords[0]][start_coords[1]-1] == 'B':
128128
maze_list[start_coords[0]][start_coords[1]] = 'O'
129129
maze_list[start_coords[0]][start_coords[1]-1] = 'A'
@@ -133,7 +133,7 @@ def play_game(maze_list): #Load Maze
133133
elif movement == 'S':
134134
if maze_list[start_coords[0]+1][start_coords[1]] == 'B':
135135
print("Congrats!")
136-
quit()
136+
return main(maze_list)
137137
if maze_list[start_coords[0]+1][start_coords[1]] == 'O' or maze_list[start_coords[0]+1][start_coords[1]] == 'B':
138138
maze_list[start_coords[0]][start_coords[1]] = 'O'
139139
maze_list[start_coords[0]+1][start_coords[1]] = 'A'
@@ -143,7 +143,7 @@ def play_game(maze_list): #Load Maze
143143
elif movement == 'D':
144144
if maze_list[start_coords[0]][start_coords[1]+1] == 'B':
145145
print("Congrats!")
146-
quit()
146+
return main(maze_list)
147147
if maze_list[start_coords[0]][start_coords[1]+1] == 'O' or maze_list[start_coords[0]][start_coords[1]+1] == 'B':
148148
maze_list[start_coords[0]][start_coords[1]] = 'O'
149149
maze_list[start_coords[0]][start_coords[1]+1] = 'A'
@@ -162,7 +162,7 @@ def play_game(maze_list): #Load Maze
162162

163163
# [4] Configure maze
164164
def configure_maze(maze_list):
165-
165+
166166
#To Display configuring maze menu
167167
displayconfigure_maze_menu(maze_list)
168168
#Enter option for config menu
@@ -463,4 +463,4 @@ def main(maze_list):
463463
# TODO: For some reason there is an error when you try to run the main() function
464464
# Additionally, since some functions for configure maze require a callback to main(maze_list)
465465
# They are commented as well
466-
# main(maze_list)
466+
# main(maze_list)
13 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
-343 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
-918 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)