예제 #1
0
void testSimulation(Quackle::Game &game)
{
	const int kibitzLength = 3;
	game.currentPosition().kibitz(kibitzLength);

	//UVcout << game.currentPosition() << endl;
	UVcout << game.currentPosition().moves() << endl;

	Quackle::Simulator simulator;
	simulator.setLogfile("quackletest.simulation", false);
	simulator.setPosition(game.currentPosition());

	simulator.simulate(20, 5);
	UVcout << simulator.simmedMoves() << endl;
	UVcout << "after " << simulator.iterations() << " iterations pruning to those within five points" << endl;

	simulator.pruneTo(5, kibitzLength);

	int iterationStep = 1;
	int iterationsToRun = 2;

	const bool longSim = true;
	if (longSim)
	{
		iterationStep = 10;
		iterationsToRun = 50;
	}

	const int plies = 2;

	simulator.setIgnoreOppos(false);

	for (int iterations = 0; iterations < iterationsToRun; iterations += iterationStep)
	{
		simulator.simulate(plies, iterationStep);
		UVcout << "sim results after " << iterations + iterationStep << " iterations: " << endl;

		const Quackle::SimmedMoveList &moves = simulator.simmedMoves();

		for (Quackle::SimmedMoveList::const_iterator it = moves.begin(); it != moves.end(); ++it)
		{
			UVcout << *it << endl;
		}

		UVcout << endl;
	}
}
예제 #2
0
void SimViewer::setSimulator(const Quackle::Simulator &simulator)
{
	m_averagesTab->setSimulator(simulator);
	setWindowTitle(tr("%1 iterations of %2 - Quackle").arg(simulator.iterations()).arg(QuackleIO::Util::letterStringToQString(simulator.currentPosition().currentPlayer().rack().tiles())));
}