Skip to content

Commit d011028

Browse files
committed
escape scan: randomize tie-breaking when all directions have equal clearance
1 parent 9a5e355 commit d011028

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

rcbot2/bot_navmesh.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1336,7 +1336,7 @@ void CNavMeshNavigator::updatePosition()
13361336

13371337
float score = clear;
13381338
if (hasFloor) score += 2.0f;
1339-
if (score > bestScore) { bestScore = score; bestDir = i; }
1339+
if (score > bestScore || (score == bestScore && randomInt(0, 1) == 0)) { bestScore = score; bestDir = i; }
13401340
m_tnClearance[i] = clear;
13411341
m_tnHasFloor[i] = hasFloor;
13421342
}

0 commit comments

Comments
 (0)