Пример #1
0
void Maze::generate( unsigned char alg, unsigned long seed, bool frame, bool verbose )
{
	switch ( alg )
	{
		case 0:
			generateKruskal( seed, frame, verbose );
			break;

		case 1:
			generatePrim( seed, frame, verbose );
			break;

		default:
			generatePrim( seed, frame, verbose );
	}
}
Пример #2
0
void buildMaze(GLMaze &walls, Matrix<Cell> &graphSpace, Matrix<char> &tileSpace, unsigned int tilesize,
		unsigned int texwall, unsigned int texfloor, unsigned int texceil, ConfigInfo *config)
{
	graphSpace = Matrix<Cell>(config->matrixDimensions);
	int algorithm = config->algorithm;

	switch (algorithm) {
		case PRIM:
			generatePrim(graphSpace);
			break;
		case DFS:
			generateDFS(graphSpace);
			break;
		case DRUNK:
			generateDrunk(graphSpace);
			break;
		case KRUSKAL:
			generateKruskal(graphSpace);
			break;
		case BINARY:
			generateBinary(graphSpace);
			break;
		case OLDEST:
			generateOldest(graphSpace);
			break;
		case SUBDIVISION:
			generateSubdivision(graphSpace);
			break;
		case RANDOM: /* FALLTHROUGH */
		default:
			generateRandom(graphSpace);
			break;
	}

	tileSpace = generateTileSpace(graphSpace);
	walls.buildAll(tileSpace, tilesize);
	walls.buildAABB(tileSpace, tilesize);
	walls.texWall = texwall;
	walls.texFloor = texfloor;
	walls.texCeil = texceil;
#if defined DEVEL_SHOW_MAZE
	std::cout << "Generated using [" << AlgorithmTable[algorithm].name << "]" << std::endl << std::endl;
	std::cout << tileSpace << std::endl;
#endif
}