Skip to content

Commit

Permalink
DO evolve only once per generation
Browse files Browse the repository at this point in the history
  • Loading branch information
U1F30C committed Nov 27, 2020
1 parent a9ac77c commit 5520cf4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/scenes/game/GameScene.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ class GameScene extends Phaser.Scene {
* Handle game restart
*/
onGameRestart() {
this.trainer.train();
console.log(this.trainer.ga.mostFit.genome, this.trainer.ga.mostFit.fitness);
this.isPlaying = true;
this.readyToRestart = false;

Expand All @@ -230,8 +232,6 @@ class GameScene extends Phaser.Scene {
* Handle gameover
*/
onGameOver() {
this.trainer.train();
console.log(this.trainer.population[0].genome);
const { width: gameWidth, height: gameHeight } = this.scale.gameSize;

this.isPlaying = false;
Expand Down

0 comments on commit 5520cf4

Please sign in to comment.