예제 #1
0
파일: maze.c 프로젝트: AndrewWUw/cs9021
int main(int argc, char **argv) {

    if (argc > 2 || (argc == 2 && strcmp(argv[1], "print"))) {
        printf(
                "I expect no command line argument or \"print\" as unique command line argument.\n");
        return EXIT_FAILURE;
    }
    if (!get_input()) {
        printf("Incorrect input.\n");
        return EXIT_FAILURE;
    }
    convertMaze();
    if (argc == 2) {
        drawMaze();
        return EXIT_SUCCESS;
    }

    countGates();
    countWalls();
    countInAccAreas();
    countAccAreas();
    countCuldesacs();
    countPaths();
    outputResult();

    return EXIT_SUCCESS;
}
예제 #2
0
Maze * getMaze (void) {
	/*Pointer to the maze file*/
	FILE * mazeFile = openFile("maze.txt");
	/*Convert the maze file to a 2D array*/
	Maze * maze = convertMaze(mazeFile);
	convertBinary(maze);
	
	return maze;
}