int main(int argc, char **argv){
	start = (State *) malloc(sizeof(State));
	start->from = -1;
	goal = (State *) malloc(sizeof(State));
	char defaultMaze[] = "maze1.txt";
	char * mazeFilename = read_string(argc, argv, "-m", defaultMaze);
	loadMaze(mazeFilename);
	
	AS_Node * startNode = newASNode(getHeuristic(start), 0);
	startNode->state = start;
	AS_Config config;
	AS_initConfig(&config);
	config.areSameStates = &areSameState;
	config.isGoalState = &isGoalState;
	config.expandNode = &expandNode;
	config.queueInitialCapacity = 20000;
	config.closedSetChunkSize = 20000;
	config.startNode = startNode;
	
	AS_NodePointer * path = AS_search(&config);
	
	printMaze();
	
	if(path){
		printf("Solution found.\n");
		assignPathToMaze(path);
		printMaze();
		AS_freePath(path);
	}else{
		printf("Solution not found\n.");
	}
	return 0;
}
Example #2
0
//Load maze definition from file located in 'path'
char *MazeEnv::loadMazeFromFile(const char* path, int *nRows, int *nColumns){

	loadMaze(path);
	*nRows = this->nRows;
	*nColumns = this->nColumns;

	return &maze[0][0];
}
Example #3
0
bool MazeEnv::initialize(){
	//loading maze from file
	try {
		loadMaze(mazePath.c_str());
	} catch (std::string text) {
		throw (text);
	}
	return true;
}
Example #4
0
Maze::Maze(std::string filename, int width, int heigth) {
    mFilename = filename;
    mWidth = width;
    mHeigth = heigth;

    loadMaze();
    updateRatio();

}
Example #5
0
int main(int argc, char** argv) {

	/**
	* Main function for the whole PAC Game
	*/

	curLevel[0] = '1';
	curLevel[1] = '\0';
	loadMaze();
	loadConfig();
	srand(time(NULL));
	winsizex=config->resx,winsizey=config->resy;

	//Pac initialization
	agentsSet();

	cameraSetting.posx = 0.0;
	cameraSetting.posy = 0.0;
	cameraSetting.posz = 0.0;
	cameraSetting.dirx = 0.0;
	cameraSetting.diry = 0.0;
	cameraSetting.dirz = -1.0;
	cameraSetting.upx = 0.0;
	cameraSetting.upy = 1.0;
	cameraSetting.upz = 0.0;
	cameraSetting.cameraMode = 0;
	prevMouseX = INT_MAX;
	prevMouseY = INT_MAX;
	unbuildPacAIMaze();
	pacControlAgent = 0;

	
    init(argc, argv); //Initialize rendering
	
	//Set functions for glutMainLoop to call
	glutDisplayFunc(draw);
	glutReshapeFunc(handleResize);
	glutKeyboardFunc(key);
	glutKeyboardUpFunc(keyUp);
	glutSpecialFunc(keyListen);
	glutMotionFunc(mouseMotion);
	glutMouseFunc(mouse);
	//glutIdleFunc(motion);
	//glutIdleFunc(draw);
	startTime = prevFrameTime = curFrameTime = glutGet(GLUT_ELAPSED_TIME);
	glutTimerFunc(ANIM, motion, 0);
	glutMainLoop(); //Start the main loop. glutMainLoop doesn't return.
	return 0; //This line is never reached
}
Example #6
0
int test_maze_flash ()
{
    int rv = MAZE_SOLVER_E_SUCCESS;
    labyrinthe maze, maze_to_discovert = {{{{WALL_PRESENCE,NO_WALL,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{WALL_PRESENCE,NO_WALL,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,WALL_PRESENCE,WALL_PRESENCE,INFINITY_WEIGHT},{WALL_PRESENCE,WALL_PRESENCE,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{WALL_PRESENCE,NO_WALL,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,WALL_PRESENCE,WALL_PRESENCE,INFINITY_WEIGHT},{WALL_PRESENCE,NO_WALL,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,WALL_PRESENCE,WALL_PRESENCE,INFINITY_WEIGHT}},{{WALL_PRESENCE,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,NO_WALL,NO_WALL,INFINITY_WEIGHT},{WALL_PRESENCE,WALL_PRESENCE,NO_WALL,NO_WALL,INFINITY_WEIGHT},{WALL_PRESENCE,WALL_PRESENCE,NO_WALL,NO_WALL,INFINITY_WEIGHT},{WALL_PRESENCE,WALL_PRESENCE,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{WALL_PRESENCE,WALL_PRESENCE,NO_WALL,NO_WALL,INFINITY_WEIGHT},{WALL_PRESENCE,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,WALL_PRESENCE,WALL_PRESENCE,INFINITY_WEIGHT},{WALL_PRESENCE,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT}},{{WALL_PRESENCE,WALL_PRESENCE,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{WALL_PRESENCE,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{WALL_PRESENCE,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{WALL_PRESENCE,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,NO_WALL,NO_WALL,INFINITY_WEIGHT}},{{WALL_PRESENCE,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{WALL_PRESENCE,WALL_PRESENCE,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{WALL_PRESENCE,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,NO_WALL,NO_WALL,INFINITY_WEIGHT},{WALL_PRESENCE,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,NO_WALL,NO_WALL,INFINITY_WEIGHT}},{{WALL_PRESENCE,NO_WALL,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{WALL_PRESENCE,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,NO_WALL,NO_WALL,INFINITY_WEIGHT}},{{WALL_PRESENCE,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{WALL_PRESENCE,WALL_PRESENCE,NO_WALL,NO_WALL,INFINITY_WEIGHT},{WALL_PRESENCE,NO_WALL,WALL_PRESENCE,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,NO_WALL,NO_WALL,INFINITY_WEIGHT},{WALL_PRESENCE,WALL_PRESENCE,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{WALL_PRESENCE,WALL_PRESENCE,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{WALL_PRESENCE,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{WALL_PRESENCE,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,NO_WALL,NO_WALL,INFINITY_WEIGHT}},{{WALL_PRESENCE,NO_WALL,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{WALL_PRESENCE,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{WALL_PRESENCE,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{WALL_PRESENCE,WALL_PRESENCE,NO_WALL,NO_WALL,INFINITY_WEIGHT},{WALL_PRESENCE,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,NO_WALL,NO_WALL,INFINITY_WEIGHT}},{{WALL_PRESENCE,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,WALL_PRESENCE,WALL_PRESENCE,INFINITY_WEIGHT},{WALL_PRESENCE,WALL_PRESENCE,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{WALL_PRESENCE,NO_WALL,WALL_PRESENCE,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{WALL_PRESENCE,WALL_PRESENCE,NO_WALL,NO_WALL,INFINITY_WEIGHT},{WALL_PRESENCE,WALL_PRESENCE,NO_WALL,NO_WALL,INFINITY_WEIGHT},{WALL_PRESENCE,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{WALL_PRESENCE,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,NO_WALL,NO_WALL,INFINITY_WEIGHT}},{{WALL_PRESENCE,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,WALL_PRESENCE,WALL_PRESENCE,INFINITY_WEIGHT},{WALL_PRESENCE,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,WALL_PRESENCE,WALL_PRESENCE,INFINITY_WEIGHT},{WALL_PRESENCE,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,NO_WALL,NO_WALL,INFINITY_WEIGHT}},{{WALL_PRESENCE,NO_WALL,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,WALL_PRESENCE,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,NO_WALL,NO_WALL,INFINITY_WEIGHT}},{{WALL_PRESENCE,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,NO_WALL,NO_WALL,INFINITY_WEIGHT}},{{WALL_PRESENCE,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,NO_WALL,NO_WALL,INFINITY_WEIGHT}},{{WALL_PRESENCE,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,NO_WALL,NO_WALL,INFINITY_WEIGHT}},{{WALL_PRESENCE,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,NO_WALL,NO_WALL,INFINITY_WEIGHT}},{{WALL_PRESENCE,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,NO_WALL,NO_WALL,INFINITY_WEIGHT}},{{WALL_PRESENCE,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,NO_WALL,NO_WALL,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,NO_WALL,NO_WALL,INFINITY_WEIGHT}},{{WALL_PRESENCE,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,NO_WALL,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT},{NO_WALL,WALL_PRESENCE,WALL_PRESENCE,NO_WALL,INFINITY_WEIGHT}}}};
    coordinate end_coordinate = {0,0};
    positionRobot start_position = {0,FALSE,{8,8}};
    rv=saveMaze(&maze_to_discovert, &start_position, &end_coordinate);
    if (rv != FLASH_DRIVER_E_SUCCESS)
    {
    }
    loadMaze(&maze, &start_position, &end_coordinate);
    printMaze(maze,end_coordinate);
    printLength(maze, end_coordinate.x, end_coordinate.y);
    while (expanderJoyFiltered() != JOY_LEFT);
    return rv;
}
void microMouseServer::connectSignals()
{
    //connect all signals

    connect(ui->menu_loadMaze, SIGNAL(triggered()), this, SLOT(loadMaze()));
    connect(ui->menu_saveMaze, SIGNAL(triggered()), this, SLOT(saveMaze()));
    connect(ui->menu_connect2Mouse, SIGNAL(triggered()), this, SLOT(connect2mouse()));
    connect(ui->menu_startRun, SIGNAL(triggered()), this, SLOT(startAI()));

    connect(_comTimer, SIGNAL(timeout()), this, SLOT(netComs()));
    connect(_aiCallTimer, SIGNAL(timeout()), this, SLOT(studentAI()));

    connect(this->maze, SIGNAL(passTopWall(QPoint)), this, SLOT(addTopWall(QPoint)));
    connect(this->maze, SIGNAL(passBottomWall(QPoint)), this, SLOT(addBottomWall(QPoint)));
    connect(this->maze, SIGNAL(passLeftWall(QPoint)), this, SLOT(addLeftWall(QPoint)));
    connect(this->maze, SIGNAL(passRightWall(QPoint)), this, SLOT(addRightWall(QPoint)));
    connect(this->maze, SIGNAL(takeBottomWall(QPoint)),this,SLOT(removeBottomWall(QPoint)));
    connect(this->maze, SIGNAL(takeTopWall(QPoint)),this,SLOT(removeTopWall(QPoint)));
    connect(this->maze, SIGNAL(takeLeftWall(QPoint)),this,SLOT(removeLeftWall(QPoint)));
    connect(this->maze, SIGNAL(takeRightWall(QPoint)),this,SLOT(removeRightWall(QPoint)));
}
Example #8
0
Maze::Maze(const TextureHolder& textures, const sf::Vector2u& mazeSize) :
    mazeSize_(mazeSize),
    tileMap_(textures.resource(TextureId::Tiles)),
	mazeTexture_(),
	hitBox_(),
	contactNormals_(3),
	mazeMap_(),
	tileTextureById_(),
	tileHitBoxesById_(),
	wallCommand_()
{
	assert(tileSize > wallSize);
	mazeMap_.resize(mazeSize_.y);
	for(std::size_t i = 0; i < mazeSize_.y; ++i)
		mazeMap_[i].resize(mazeSize_.x);
    mazeTexture_.setPrimitiveType(sf::Triangles);
    mazeTexture_.resize(mazeSize_.x * mazeSize_.y* 6); //It needs 2 triangles to make a quad which makes 6 vertices.

	loadTiles();
    loadMaze();
}