コード例 #1
0
ファイル: letterbox.cpp プロジェクト: cdhowie/Quackle
Clue Letterbox::mathClue(const QString &clue)
{
	Dict::WordList clueWords = QuackleIO::DictFactory::querier()->query(clue);
	QString word = (*clueWords.begin()).word;

	int bestChew = 0;
	QString ret;

	for (int i = 0; i < word.length(); i++)
	{
		QString query = word.left(i) + word.right(word.length() - i - 1);
		Dict::WordList words = QuackleIO::DictFactory::querier()->query(query);
		for (Dict::WordList::iterator it = words.begin(); it != words.end(); ++it)
		{
			int chew = chewScore((*it).word, word);
			if (chew > bestChew)
			{
				bestChew = chew;
				ret = (*it).word + " + " + word.at(i);
			}
		}
	}

	if (bestChew > 2)
		return Clue(ret);

	return Clue(arrangeLettersForUser(word));
}
コード例 #2
0
ファイル: letterbox.cpp プロジェクト: cdhowie/Quackle
Clue Letterbox::clueFor(const QString &word)
{
	if (word.isNull())
		return Clue(QString::null);

	if (LetterboxSettings::self()->mathMode)
		return mathClue(word);

	return Clue(arrangeLettersForUser(word));
}
コード例 #3
0
ファイル: MurderWeapon.cpp プロジェクト: ARagnvaldN/Cluedo
	std::string MurderWeapon::description() const
	{

		_player->receive_clue(Clue::TOOL, Clue(name(), "This is the murder weapon."));

		return "There is blood on the weapon.";
	}
コード例 #4
0
ファイル: ak_problem.cpp プロジェクト: semiexp/penciloid2
Problem::Problem(Y height, X width, const char* clues[]) : grid_(height, width)
{
	for (Y y(0); y < height; ++y) {
		for (X x(0); x < width; ++x) {
			if ('0' <= clues[y][x] && clues[y][x] <= '4') {
				SetClue(CellPosition(y, x), Clue(clues[y][x] - '0'));
			} else if (clues[y][x] == '#') {
				SetClue(CellPosition(y, x), kBlock);
			} else {
				SetClue(CellPosition(y, x), kEmpty);
			}
		}
	}
}