diff --git a/src/botinterface.cpp b/src/botinterface.cpp index a4f1cc2..51832a8 100755 --- a/src/botinterface.cpp +++ b/src/botinterface.cpp @@ -39,16 +39,16 @@ PlayerDirection AISnake::GetInput(void) { } void AISnake::UpdateProbability(int snakeSize) { - probabilityBFS = 1 - ((double) snakeSize) / 1000; + thresholdDFS = 1 - ((double) snakeSize) / 1000; return; } void AISnake::AdjustProbability(double amount) { - probabilityBFS += amount; - if (probabilityBFS > 1.0) - probabilityBFS = 1.0; - if (probabilityBFS < 0.0) - probabilityBFS = 0.0; + thresholdDFS += amount; + if (thresholdDFS > 1.0) + thresholdDFS = 1.0; + if (thresholdDFS < 0.0) + thresholdDFS = 0.0; return; } @@ -76,7 +76,7 @@ void AISnake::GetNewPath(void) { // Search for food // Probability-based approach for fun double roll = ((double) GenerateRandomNumber(RAND_MAX)) / ((double) RAND_MAX); - if (roll <= probabilityBFS) + if (roll <= thresholdDFS) BFS(); else DFS(); diff --git a/src/botinterface.hpp b/src/botinterface.hpp index 89c8cf6..bf023db 100755 --- a/src/botinterface.hpp +++ b/src/botinterface.hpp @@ -19,7 +19,7 @@ public: private: int totalLength = 0; double average = 0; - double probabilityBFS = 0.200; + double thresholdDFS = 0.200; bool pathFailed = false; // Generic search algorithms