Пример #1
0
void testGame()
{
	Quackle::Game game;

	Quackle::PlayerList players;

	Quackle::Player bogowinA(MARK_UV("BogowinA"), Quackle::Player::ComputerPlayerType, 110);
	bogowinA.setComputerPlayer(new Quackle::SmartBogowin());
	players.push_back(bogowinA);
	
	Quackle::Player bogowinB(MARK_UV("BogowinB"), Quackle::Player::ComputerPlayerType, 110);
	bogowinB.setComputerPlayer(new Quackle::SmartBogowin());
	players.push_back(bogowinB);

	game.setPlayers(players);
	game.associateKnownComputerPlayers();

	game.addPosition();

	//testValidator(game);

	const bool setupRetroPosition = false;

	if (setupRetroPosition)
	{
		game.commitMove(Quackle::Move::createPlaceMove(MARK_UV("8c"), QUACKLE_ALPHABET_PARAMETERS->encode(MARK_UV("AMNION"))));
		game.currentPosition().setCurrentPlayerRack(Quackle::Rack(QUACKLE_ALPHABET_PARAMETERS->encode(MARK_UV("L"))));
		UVcout << "current rack: " << game.currentPosition().currentPlayer().rack() << endl;
		game.currentPosition().kibitz(10);
		UVcout << "moves: " << endl << game.currentPosition().moves() << endl;
	}

	const int playahead = 50;

	for (int i = 0; i < playahead; ++i)
	{
		if (game.currentPosition().gameOver())
		{
			UVcout << "GAME OVER" << endl;
			break;
		}

		const Quackle::Player player(game.currentPosition().currentPlayer());
		Quackle::Move compMove(game.haveComputerPlay());
		UVcout << "with " << player.rack() << ", " << player.name() << " commits to " << compMove << endl;
	}

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

	testGameReport(game);

	// insert test...() calls here
	// testSimulation(game);
	
	//UVcout << "History:" << endl << game.history() << endl;
}
Пример #2
0
void PlayerBrief::setPlayer(const Quackle::Player &player)
{
	QString nameText = (m_isCurrent? "<b>%1</b>" : "%1");
	nameText = nameText.arg(QuackleIO::Util::uvStringToQString(player.name()));

	if (m_winnerStatus == Winner || m_winnerStatus == Cowinner)
	{
		nameText += QString("<h3>%1</h3>").arg(m_winnerStatus == Winner? tr("Winner!") : tr("Cowinner"));
	}

	m_name->setText(nameText);
	m_score->setText(QString("<h2>%1</h2>").arg(player.score()));

	if (m_isCurrent)
	{
		setFrameStyle(QFrame::Panel | QFrame::Sunken);
		setLineWidth(2);
	}
	else
	{
		setFrameStyle(QFrame::NoFrame);
	}

}