()
| 77 | } |
| 78 | |
| 79 | mutate() { |
| 80 | let mutationRate = 0.1; |
| 81 | let chanceOfNewInstruction = 0.02; |
| 82 | for (let i = this.parentReachedBestLevelAtActionNo; i < this.instructions.length; i++) { |
| 83 | if (random() < chanceOfNewInstruction) { |
| 84 | this.instructions[i] = this.getRandomAction() |
| 85 | } else if (random() < mutationRate) { |
| 86 | this.instructions[i].mutate(); |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | mutateActionNumber(actionNumber){ |
| 92 | // let mutationRate = 0.1; |
no test coverage detected