本文整理汇总了C++中MoveList::AddMoves方法的典型用法代码示例。如果您正苦于以下问题:C++ MoveList::AddMoves方法的具体用法?C++ MoveList::AddMoves怎么用?C++ MoveList::AddMoves使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MoveList
的用法示例。
在下文中一共展示了MoveList::AddMoves方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeComplexMovesParallel
void MakeComplexMovesParallel()
{
bool newFlag;
for (int dlen = 2; dlen <= 13; dlen++)
{
int slStart = 1, cStart = 0;
bool flag;
cout << "\nDeclaring length " << dlen << ":\n";
double histRest = histCount[HIST_ORIG_COUNT][dlen];
for (int hno = 1; hno < HIST_COMPLEX; hno++)
histRest -= histCount[hno][dlen];
if (histRest < 1)
histRest = 1;
int skip = 0;
do
{
if (++skip == 10)
{
cout << "Count " << setw(8) << cStart << " (" <<
setw(5) << std::fixed << std::setprecision(2) <<
100. * histCount[HIST_COMPLEX][dlen] /
histRest << "%)" << endl;
skip = 0;
}
flag = MakeComplexTables(slStart, cStart, dlen);
StartTimer();
MakeComplexDistribute();
for (int i = 0; i < batchLen; i++)
{
int sl = holdingList[i].GetSuitLength();
int c = holdingList[i].GetCounter();
singles[sl][c].moveNo = moveList.AddMoves(
defList1[i], defList2[i], holdingList[i], newFlag);
histCount[HIST_COMPLEX][dlen]++;
// Header& header = singles[sl][c].defp->GetHeader();
// int r = static_cast<int>(header.GetMaxRank());
unsigned r = moveList.GetMaxRank(singles[sl][c].moveNo);
histRank[HIST_COMPLEX][r]++;
if (newFlag)
{
histMoveCount[HIST_COMPLEX][dlen]++;
histMoveRank[HIST_COMPLEX][r]++;
}
}
EndTimer();
}
while (flag);
}
cout << "\n";
}
示例2: MakeComplexMoves
void MakeComplexMoves()
{
int hist[14] = {0};
bool newFlag;
// General case.
Holding holding;
for (int dlen = 2; dlen <= 13; dlen++)
{
for (int sl = 1; sl <= 13; sl++)
{
for (int c = 0; c < SDS_NUMSINGLES[sl]; c++)
{
if (singles[sl][c].moveNo)
continue;
if (singles[sl][c].declLen != dlen)
continue;
// if (sl == 10 && c == 0x81aa)
// debugComplex = true;
// else
// debugComplex = false;
// cout << setw(2) << dlen <<
// setw(3) << sl << " " << setw(3) << hex << c << dec << endl;
holding.Set(sl, c);
DefList def1, def2;
MakeComplexSingleMove(holding, def1, def2);
StartTimer();
singles[sl][c].moveNo = moveList.AddMoves(def1, def2,
holding, newFlag);
EndTimer();
histCount[HIST_COMPLEX][dlen]++;
// Header& header = singles[sl][c].defp->GetHeader();
// int r = static_cast<int>(header.GetMaxRank());
unsigned r = moveList.GetMaxRank(singles[sl][c].moveNo);
histRank[HIST_COMPLEX][r]++;
if (newFlag)
{
histMoveCount[HIST_COMPLEX][dlen]++;
histMoveRank[HIST_COMPLEX][r]++;
}
}
}
}
}
示例3: BestMoveAfterPard
bool BestMoveAfterPard(
Holding& holding,
DefList& def)
{
int slNew = 0, cNew = 0;
holding.SetRhoNo();
if (! holding.MakePlay(slNew, cNew))
{
const Trick& trick = holding.GetTrick();
def.Set1(trick);
if (debugComplex)
{
DumpStatus(def, "BestMoveAfterPard: Simple play");
holding.PrintPlayNew(cout);
}
return true;
}
assert(slNew >= 1 && slNew <= 12);
assert(cNew >= 0 && cNew < SDS_NUMSINGLES[slNew]);
if (singles[slNew][cNew].moveNo == 0)
{
Holding tmpHolding;
tmpHolding.Set(slNew, cNew);
if (debugComplex)
{
cout << "Start recursing\n";
tmpHolding.Print(cout);
}
DefList deftmp1, deftmp2;
bool newFlag;
MakeComplexSingleMove(tmpHolding, deftmp1, deftmp2);
int sl = tmpHolding.GetSuitLength();
int c = tmpHolding.GetCounter();
// TODO: Does tmpHolding really change in the invocation?
singles[sl][c].moveNo = moveList.AddMoves(
deftmp1, deftmp2, tmpHolding, newFlag);
if (debugComplex)
{
deftmp1.Print(cout);
deftmp2.Print(cout);
cout << "Done recursing\n";
}
}
assert(singles[slNew][cNew].moveNo != 0);
def = moveList.GetCombinedMove(singles[slNew][cNew].moveNo);
if (debugComplex)
{
DumpStatus(def, "BestMoveAfterPard: Stored play count", slNew, cNew);
Holding hTmp;
hTmp.Set(slNew, cNew);
hTmp.Print(cout);
holding.PrintPlayNew(cout);
fflush(stdout);
}
def += holding;
// cout << "After +=, dc " << debugComplex << endl;
if (debugComplex)
DumpStatus(def, "Prepended: Stored play count");
// cout.flush();
return true;
}