Skip to content

Commit

Permalink
Merge pull request #50 from gabriel-lau/Play-maze
Browse files Browse the repository at this point in the history
Additional bug fixes for play maze feature
  • Loading branch information
gabriel-lau authored Feb 9, 2020
2 parents c1b0be9 + f82853c commit 29684e3
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 8 deletions.
1 change: 0 additions & 1 deletion .coverage
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
!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]}}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

*.pyc
14 changes: 7 additions & 7 deletions SRC/Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ def play_game(maze_list): #Load Maze
print('\n''Location of Start (A) = ' + '(Row ' + str(row_A) + ', Column ' + str(column_A) +')') # Printing out location
print('\n''Location of Start (B) = ' + '(Row ' + str(row_B) + ', Column ' + str(column_B) +')')

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

if movement == 'M':
return main(maze_list)
elif movement == 'W':
if maze_list[start_coords[0]-1][start_coords[1]] == 'B': # Check if it is the end
print("Congrats!")
quit()
return main(maze_list)
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
maze_list[start_coords[0]][start_coords[1]] = 'O'
maze_list[start_coords[0]-1][start_coords[1]] = 'A'
Expand All @@ -123,7 +123,7 @@ def play_game(maze_list): #Load Maze
elif movement == 'A':
if maze_list[start_coords[0]][start_coords[1]-1] == 'B':
print("Congrats!")
quit()
return main(maze_list)
if maze_list[start_coords[0]][start_coords[1]-1] == 'O' or maze_list[start_coords[0]][start_coords[1]-1] == 'B':
maze_list[start_coords[0]][start_coords[1]] = 'O'
maze_list[start_coords[0]][start_coords[1]-1] = 'A'
Expand All @@ -133,7 +133,7 @@ def play_game(maze_list): #Load Maze
elif movement == 'S':
if maze_list[start_coords[0]+1][start_coords[1]] == 'B':
print("Congrats!")
quit()
return main(maze_list)
if maze_list[start_coords[0]+1][start_coords[1]] == 'O' or maze_list[start_coords[0]+1][start_coords[1]] == 'B':
maze_list[start_coords[0]][start_coords[1]] = 'O'
maze_list[start_coords[0]+1][start_coords[1]] = 'A'
Expand All @@ -143,7 +143,7 @@ def play_game(maze_list): #Load Maze
elif movement == 'D':
if maze_list[start_coords[0]][start_coords[1]+1] == 'B':
print("Congrats!")
quit()
return main(maze_list)
if maze_list[start_coords[0]][start_coords[1]+1] == 'O' or maze_list[start_coords[0]][start_coords[1]+1] == 'B':
maze_list[start_coords[0]][start_coords[1]] = 'O'
maze_list[start_coords[0]][start_coords[1]+1] = 'A'
Expand All @@ -162,7 +162,7 @@ def play_game(maze_list): #Load Maze

# [4] Configure maze
def configure_maze(maze_list):

#To Display configuring maze menu
displayconfigure_maze_menu(maze_list)
#Enter option for config menu
Expand Down Expand Up @@ -463,4 +463,4 @@ def main(maze_list):
# TODO: For some reason there is an error when you try to run the main() function
# Additionally, since some functions for configure maze require a callback to main(maze_list)
# They are commented as well
# main(maze_list)
# main(maze_list)
Binary file modified SRC/__pycache__/Main.cpython-37.pyc
Binary file not shown.
Binary file modified __pycache__/test_configure_maze.cpython-37-pytest-5.3.2.pyc
Binary file not shown.
Binary file modified __pycache__/test_display_maze.cpython-37-pytest-5.3.2.pyc
Binary file not shown.
Binary file modified __pycache__/test_menu.cpython-37-pytest-5.3.2.pyc
Binary file not shown.
Binary file modified __pycache__/test_play_maze.cpython-37-pytest-5.2.2.pyc
Binary file not shown.
Binary file modified __pycache__/test_read_maze.cpython-37-pytest-5.3.2.pyc
Binary file not shown.
Binary file removed __pycache__/testfunctions.cpython-37.pyc
Binary file not shown.

0 comments on commit 29684e3

Please sign in to comment.