You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first game of the first generation is ignored. From the second game the program starts evaluating the fitness of the genomes. Also, from the second game, the dinosaur can't keep 'DOWN' when the down is kept pressed, i.e. the input taken becomes slow. Any leads on where could possible changes be made on the code?
The text was updated successfully, but these errors were encountered:
var _startKeyInterval; //will automatically init to zero
GameManipulator.startNewGame = function (next) {
// Refresh state
GameManipulator.readGameState();
// If game is already over, press space
if (GameManipulator.gamestate == 'OVER') {
clearInterval(_startKeyInterval);
// Set start callback
GameManipulator.onGameStart = function (argument) {
clearInterval(_startKeyInterval);
next && next();
};
// Press space to begin game (repetidelly)
_startKeyInterval = setInterval(function (){
// Due to dino slowly gliding over the screen after multiple restarts,
//its better to just reload the page
GameManipulator.reloadPage();
setTimeout(function() {
// Once reloaded we wait 0.5sec for it to let us start the game with a space.
robot.keyTap(' ');
}, 500);
}, 300);
// Refresh state
GameManipulator.readGameState();
} else {
// Wait die, and call recursive action
GameManipulator.onGameEnd = function () {
GameManipulator.startNewGame(next);
}
}
}
Before the first game, the gameState = 'PLAYING', hence the if selection flow is skipped, the GamemManipulator then waits to start the next game, from whereon the if will always read true per game and the next() callback will be initiated.
The first game of the first generation is ignored. From the second game the program starts evaluating the fitness of the genomes. Also, from the second game, the dinosaur can't keep 'DOWN' when the down is kept pressed, i.e. the input taken becomes slow. Any leads on where could possible changes be made on the code?
The text was updated successfully, but these errors were encountered: