Python Drill
Due: Thurday, July 26th at 11:59PM


This lab asks you to wrtie several Python programs, one program per file, to help you build skill and confidence.

Is a Valid Maze? (

Remember the MazeSolver from last week? This program asks you to write a function, isValidMaze(m), that takes a maze, read in by the same readMaze() function as last week, and determine if it is, in fact, a valid maze. The function should return True or False, as appropriate.

It is a valid maze if (a) there exist exactly one start and one finish, (b) the finish is reachable from the start via paths, (c) every cell is a start, a finish, a wall, or a path, and (d) every path is reachable from the start.

Hint: Think recursion. Also think breadcrumbs. Also think iteration.

JailBreak! (

Consider an nxm grid, represented a jailyard. It is represented like a maze, and read in like a maze -- but there is no start, there is no finish, and the "paths" can have any shape and be of any width. Basically, if it isn't a wall, you can traverse it.

So, here's the question, "Given a location in the jailyard, can the convict escape?" That is to say, is there a path from a particular (row,col) up to, and including, an edge location. Please write a function, canEscape(maze,row,col) that returns True or False, as appropriate.

Hint: Think recursion and breadcrumbs, maybe helper function.

3D Tic-Tac-Toe (

Imagine a 3D nxnTic-Tac-Toe board, where moves are made with "X" and "O". The board is represented as a "3D" list-of-lists-of-lists. Now, write a function hasWinner(board), that returns True if someone has won the game or False, otherwise.



To handin, create a folder with your andrewID as usual. Within that folder, create a folder called 1, and put your three files inside. If you need to resubmit for any reason, create a new folder in your andrewID folder called 2, etc.

Please make sure your files and functions are named correctly.