- Size of road grid
- Connectivity description of road grid
a maze which descripted by string.
Input:
3 3
0,1 0,2;0,0 1,0;0,1 1,1;0,2 1,2;1,0 1,1;1,1 1,2;1,1 2,1;1,2 2,2;2,0 2,1
Output:
[W] [W] [W] [W] [W] [W] [W]
[W] [R] [W] [R] [R] [R] [W]
[W] [R] [W] [R] [W] [R] [W]
[W] [R] [R] [R] [R] [R] [W]
[W] [W] [W] [R] [W] [R] [W]
[W] [R] [R] [R] [W] [R] [W]
[W] [W] [W] [W] [W] [W] [W]
Notice: more details in problem description.
python 2.7.8
tw_homework
│───README.md
└───drawMaze.py # 1. Rendering the maze to string; 2. Checking correctness of input.
└───unitTest.py # Running some unit tests.
Check the correctness of input:
the input contains non-numeric parameters.
- the number is negative.
- the number is decimal.
- x(y) of road grid is zero.
- the x(y) of grid is out of range of maze.
- invalid size of maze. eg "3 3 3" or "2"
- the grid is incomplete, eg "1, 2,0;" or "1 2,0"
- the grid pair is incomplete, eg "2,0;" or "2,0 ;"
Difference value of x(y) between two grids is greater than one.
- Running the main program
python drawMaze.py
TestCase:
3 3 0,1 0,2;0,0 1,0;0,1 1,1;0,2 1,2;1,0 1,1;1,1 1,2;1,1 2,1;1,2 2,2;2,0 2,1
- Running unit tests.
python unitTest.py