本文整理汇总了C++中Generator::findstaticbest方法的典型用法代码示例。如果您正苦于以下问题:C++ Generator::findstaticbest方法的具体用法?C++ Generator::findstaticbest怎么用?C++ Generator::findstaticbest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Generator
的用法示例。
在下文中一共展示了Generator::findstaticbest方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main() {
G.loaddawg("sowpods.dawg");
G.loadworths("mavenworths");
G.loadsyn2("fakesyn2");
cout << "Lexicon loaded." << endl;
ifstream countfile("sowpods-counts.txt");
while(!countfile.eof()) {
string w;
int c;
countfile >> c;
countfile >> w;
if (!countfile.eof()) {
playability[w] = c;
}
}
cout << "Playability crap loaded." << endl;
ifstream twlfile("twl.raw");
while(!twlfile.eof()) {
string w;
twlfile >> w;
twl[w] = true;
}
cout << "TWL loaded." << endl;
srand(time(NULL));
puzzlenumber = 1;
for (int i = 0; i < 1000; i++)
{
B.init();
S.init();
S.refill(R[0]);
S.refill(R[1]);
for (int j = 0; j < 10; j++)
{
G.setboard(B);
G.allcrosses();
G.setrack(R[j % 2]);
G.setrecordall(true);
G.findstaticbest(true);
Move M = sim(R[j % 2]);
if (M.action == Place)
{
B.makemove(M);
R[j % 2] -= M;
S.refill(R[j % 2]);
}
else if (M.action == Exchange)
{
S.exch(M, R[j % 2]);
}
puzzlenumber++;
}
}
}
示例2: sim
//.........这里部分代码省略.........
}
sums.clear();
ns.clear();
for (int i = 0; i < num; i++) {
sums.push_back(0);
ns.push_back(0);
}
for (int k = 0; k < n; k++)
{
for (int i = 0; i < num; i++)
{
Board orig = B;
G.setboard(B);
G.allcrosses();
G.setrecordall(false);
Move M[3];
Rack sR[2];
Bag simBag = origS;
simBag.fill(sR[0], currR.tiles);
simBag.refill(sR[1]);
for (int j = 0; j < 3; j++) {
if (j > 0) {
G.setrack(sR[j % 2]);
bool canexch = false;
if (simBag.size() >= 7) {
canexch = true;
}
M[j] = G.findstaticbest(canexch);
}
else {
M[j] = movelist[i];
}
if (M[j].action == Place) {
G.makemove(M[j]);
sR[j % 2] -= M[j];
simBag.refill(sR[j % 2]);
}
else if (M[j].action == Exchange) {
simBag.exch(M[j], sR[j % 2]);
}
}
sums[i] += M[0].score - M[1].equity + M[2].equity;
ns[i]++;
}
/*
if (((k + 1) % 10) == 0) {
cout << "After " << k + 1 << " iterations:" << endl;
for (int i = 0; i < num; i++) {
cout << movelist[i] << " (" << movelist[i].score << ") " << sums[i] / ns[i] << endl;
}
}
*/
}
bool switching = true;