Added better algorithm for snake AI #1
@ -41,7 +41,7 @@ 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 < 160) {
|
if (snakeSize < 135) {
|
||||||
BFS(gameBoard, source, boundaries);
|
BFS(gameBoard, source, boundaries);
|
||||||
} else {
|
} else {
|
||||||
DFS(gameBoard, source, boundaries);
|
DFS(gameBoard, source, boundaries);
|
||||||
|
@ -30,7 +30,7 @@ namespace snakeplusplus
|
|||||||
sf::RectangleShape drawObject;
|
sf::RectangleShape drawObject;
|
||||||
sf::Event event;
|
sf::Event event;
|
||||||
bool isWindowAlive;
|
bool isWindowAlive;
|
||||||
sf::Time delay = sf::milliseconds(5);
|
sf::Time delay = sf::milliseconds(15);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user