Update dev from master #2
@ -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)
|
void AISnake::GetNewPath(const std::vector< std::vector<char> >& gameBoard, const sf::Vector2f& source, const sf::Vector2f& boundaries, const int snakeSize)
|
||||||
{
|
{
|
||||||
// Search for food
|
// Search for food
|
||||||
if (snakeSize < 135) {
|
BFS(gameBoard, source, boundaries);
|
||||||
BFS(gameBoard, source, boundaries);
|
if (gameBoard[botPathUnsanitized.top().y][botPathUnsanitized.top().x] != 'X') {
|
||||||
} else {
|
while (!botPathUnsanitized.empty()) { botPathUnsanitized.pop(); }
|
||||||
DFS(gameBoard, source, boundaries);
|
DFS(gameBoard, source, boundaries);
|
||||||
|
while (botPathUnsanitized.size() > 15) { botPathUnsanitized.pop(); }
|
||||||
}
|
}
|
||||||
// Create path for food
|
// Create path for food
|
||||||
path.push(botPathUnsanitized.top());
|
path.push(botPathUnsanitized.top());
|
||||||
|
Loading…
Reference in New Issue
Block a user