Merge pull request #548 from yapb/issue-542
fix: node selection when there's too less important nodes (fix #542)
This commit is contained in:
commit
8a22f03640
1 changed files with 18 additions and 7 deletions
|
|
@ -383,19 +383,30 @@ void Bot::postprocessGoals (const IntArray &goals, int result[]) {
|
||||||
}
|
}
|
||||||
return isOccupiedNode (index);
|
return isOccupiedNode (index);
|
||||||
};
|
};
|
||||||
|
static IntArray resulting {};
|
||||||
|
resulting.clear ();
|
||||||
|
|
||||||
// too less to choice from just return all the goals
|
// too less to choice from, this is usually waypointer mistake, number of def/offensive points count should be minimum of 4
|
||||||
if (goals.length () < 4) {
|
if (goals.length () < 4) {
|
||||||
for (size_t i = 0; i < goals.length (); ++i) {
|
auto refill = [] (const IntArray &data) {
|
||||||
result[i] = goals[i];
|
if (!data.empty ()) {
|
||||||
|
resulting.insert (0, data);
|
||||||
}
|
}
|
||||||
return;
|
};
|
||||||
|
|
||||||
|
// combine defensive and offensive and goals together to give a chance to proceed
|
||||||
|
refill (graph.m_ctPoints);
|
||||||
|
refill (graph.m_terrorPoints);
|
||||||
|
refill (graph.m_goalPoints);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
resulting.insert (0, goals);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int index = 0; index < 4; ++index) {
|
for (int index = 0; index < 4; ++index) {
|
||||||
const auto goal = goals.random ();
|
const auto goal = resulting.random ();
|
||||||
|
|
||||||
if (recurseCount <= cr::max (4, goals.length <int> ()) && isRecentOrHistorical (goal)) {
|
if (recurseCount <= cr::max (4, resulting.length <int> ()) && isRecentOrHistorical (goal)) {
|
||||||
if (index > 0) {
|
if (index > 0) {
|
||||||
index--;
|
index--;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue