Complete the solve_maze function
Description:
This function takes maze object as input and determines if there is a path from start(0,0) to end(3)
1 is a wall
2 is a Zombie
3 is destination
0 is all the free path
Complete the run function which handles key events to move player in maze
- Complete the play_music function which takes audio from file solve_maze.ogg and plays on running the code
file path for solveMusic is ../../audio/solve_maze.ogg
PyMaze¶
Goals:¶
179
game = font.render('Game Over -\n Press run to Play Again',True, Color(0,0,0))
1
import pygame
2
from pygame.color import *
3
from pygame.locals import *
4
from pygame import mixer
5
6
7
# game which has a maze and a player
8
# player has to reach the end of the maze
9
class Maze:
10
11
def __init__(self,maze=None):
12
self.maze = maze
13
self.rows = self.maze.__len__()
14
self.cols = self.maze[0].__len__()
15
16
17
def draw(self,screen):
18
19
rows = self.rows
20
cols = self.cols
21
for i in range(rows):
22
for j in range(cols):
23
24
if self.maze[i][j] == 1:
Activity: 1 ActiveCode (ac_r04_en)
You have attempted 1 of 2 activities on this page