Compare commits

..

No commits in common. "c6197e84dc29cbeba9376631509635b21ad6948a" and "677466d99ebf8747381d8810370795bb90c7dc1c" have entirely different histories.

3 changed files with 8 additions and 10 deletions

View File

@ -39,16 +39,16 @@ PlayerDirection AISnake::GetInput(void) {
}
void AISnake::UpdateProbability(int snakeSize) {
thresholdDFS = 1 - ((double) snakeSize) / 1000;
probabilityBFS = 1 - ((double) snakeSize) / 1000;
return;
}
void AISnake::AdjustProbability(double amount) {
thresholdDFS += amount;
if (thresholdDFS > 1.0)
thresholdDFS = 1.0;
if (thresholdDFS < 0.0)
thresholdDFS = 0.0;
probabilityBFS += amount;
if (probabilityBFS > 1.0)
probabilityBFS = 1.0;
if (probabilityBFS < 0.0)
probabilityBFS = 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 <= thresholdDFS)
if (roll <= probabilityBFS)
BFS();
else
DFS();

View File

@ -19,7 +19,7 @@ public:
private:
int totalLength = 0;
double average = 0;
double thresholdDFS = 0.200;
double probabilityBFS = 0.200;
bool pathFailed = false;
// Generic search algorithms

View File

@ -14,8 +14,6 @@ void GameEngine::Start(void) {
PrepareGameBoard();
if (!state.m_bNoDisplay)
graphics.StartGameWindow();
if (state.m_bIsBotControlled)
graphics.SetShowGame(true);
Loop();
}