void build_test() {

	enum {GRID_SIZE = 32};

	// build map
	GridMap *gm = new GridMap(30, 30, GRID_SIZE);
	gm->setTarget(5 * GRID_SIZE, 5 * GRID_SIZE);

	for (int i = 0; i < 20; ++i) {
		gm->setWalkableAt(10 * GRID_SIZE, i * GRID_SIZE, false);
	}

	for (int i = 10; i < 20; ++i) {
		gm->setWalkableAt(i * GRID_SIZE, 10 * GRID_SIZE, false);
	}

	gm->updateRoute();

	// test route
	gm->printRoute();

	gm->clearCreepsInfo();
	gm->addCreepsAt(1 * GRID_SIZE, 1 * GRID_SIZE);

	canBuildAt(gm, 1 * GRID_SIZE, 1 * GRID_SIZE);
	canBuildAt(gm, 10 * GRID_SIZE, 10 * GRID_SIZE);
	canBuildAt(gm, 20 * GRID_SIZE, 20 * GRID_SIZE);

	// clear grids again
	puts("Clear grids again");
	gm->clearCreepsInfo();
	canBuildAt(gm, 1 * GRID_SIZE, 1 * GRID_SIZE);
	printf("Center of (5, 15) : (%d, %d)\n", 
			gm->toGridCenterX(5), gm->toGridCenterY(15));

	CreepFactory *factory = new CreepFactory();

	Creep *creep = factory->getCreep(creep::NORMAL);
	creep->setX(500.0);
	creep->setY(500.0);
	creep->setGridMap(gm);

	printf("%d, %d\n", gm->getNextX(193, 193), gm->getNextY(193, 193));
}
void next_test() {
	enum {GRID_SIZE = 32};

	// build map
	GridMap *gm = new GridMap(30, 30, GRID_SIZE);
	gm->setTarget(5 * GRID_SIZE, 5 * GRID_SIZE);

	for (int i = 0; i < 20; ++i) {
		gm->setWalkableAt(10 * GRID_SIZE, i * GRID_SIZE, false);
	}

	for (int i = 10; i < 20; ++i) {
		gm->setWalkableAt(i * GRID_SIZE, 10 * GRID_SIZE, false);
	}

	gm->updateRoute();

	for (int i = 0; i < 30; ++i) {
		for (int j = 0; j < 30; ++j) {
			printf("%d,%d ", gm->getNextX(j * 32 + 16, i * 32 + 16), gm->getNextY(j * 32 + 16, i * 32 + 16));
		}
		puts("");
	}
}