bot: added ability to skip display delay between specific generations
This commit is contained in:
parent
05f78d67fd
commit
b18ce89970
@ -30,6 +30,7 @@ namespace snakeplusplus
|
||||
if (isBotControlled) { while (!bot.path.empty()) { bot.path.pop(); } }
|
||||
PrepareGameBoard();
|
||||
isGameOver = false;
|
||||
graphics.SetShowGame((amountPlayed + 1) % 50 == 0);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -59,7 +60,7 @@ namespace snakeplusplus
|
||||
RegenerateFood();
|
||||
currentScore = player.body.size() * 100;
|
||||
//bot.UpdateProbability(player.body.size());
|
||||
//graphics.DisplayGameState(gameBoard, currentScore);
|
||||
graphics.DisplayGameState(gameBoard, currentScore);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -87,6 +87,7 @@ namespace snakeplusplus
|
||||
void PlayerOutput::DisplayGameState(std::vector< std::vector<char> >& gameBoard, int score)
|
||||
{
|
||||
CheckWindowEvents();
|
||||
if (delay == sf::milliseconds(0)) { return; }
|
||||
char* letterOnBoard;
|
||||
for (float y = 0; y < gameBoundaries.y; y++)
|
||||
{
|
||||
@ -120,6 +121,12 @@ namespace snakeplusplus
|
||||
return;
|
||||
}
|
||||
|
||||
void PlayerOutput::SetShowGame(bool isShowing) {
|
||||
if (isShowing) { delay = sf::milliseconds(2); }
|
||||
else { delay = sf::milliseconds(0); }
|
||||
return;
|
||||
}
|
||||
|
||||
void PlayerOutput::CheckWindowEvents(void)
|
||||
{
|
||||
while (gameWindow.pollEvent(event))
|
||||
|
@ -20,6 +20,7 @@ namespace snakeplusplus
|
||||
void DisplayGameState(std::vector< std::vector<char> >& gameBoard, int score);
|
||||
void DisplayScore(int score);
|
||||
void StartGameWindow(void);
|
||||
void SetShowGame(bool isShowing);
|
||||
private:
|
||||
void CheckWindowEvents(void);
|
||||
void DisplayEndScreen(void);
|
||||
|
Loading…
Reference in New Issue
Block a user