Exemple #1
0
int main (int argc, const char * argv[])
{
	srand(0);
	Megaminx * target = new Megaminx;
	target->setTarget(target);
	unsigned int maxInst = target->getPossibleInstructions();
	Puzzle const * test = target;
	for (int i = 0; i < 14; ++i)
	{
		int inst = rand() % maxInst;
		cout << instToCStr(inst) << endl;
		test = test->getPuzzleRotatedBy(inst);
	}
	Search * search = new Search;
	cout << "******\n";
	stack<int> * solution = search->aStarSearch(test);
	cout << search->getCreatedNodes() << " " << search->getElapsedTime() << endl;
	delete search;
	while (!solution->empty())
	{
		cout << instToCStr(solution->top()) << endl;
		solution->pop();
	}
	return 0;
}