Merge pull request 'Update dev from master' (#2) from master into dev

Reviewed-on: Trianta/snakeplusplus#2
This commit was merged in pull request #2.
This commit is contained in:
2023-10-18 09:42:26 -05:00
+3 -2
View File
@@ -41,10 +41,11 @@ namespace snakeplusplus
void AISnake::GetNewPath(const std::vector< std::vector<char> >& gameBoard, const sf::Vector2f& source, const sf::Vector2f& boundaries, const int snakeSize)
{
// Search for food
if (snakeSize < 135) {
BFS(gameBoard, source, boundaries);
} else {
if (gameBoard[botPathUnsanitized.top().y][botPathUnsanitized.top().x] != 'X') {
while (!botPathUnsanitized.empty()) { botPathUnsanitized.pop(); }
DFS(gameBoard, source, boundaries);
while (botPathUnsanitized.size() > 15) { botPathUnsanitized.pop(); }
}
// Create path for food
path.push(botPathUnsanitized.top());