()
| 114 | let levelNumber = 0; |
| 115 | |
| 116 | function draw() { |
| 117 | background(10); |
| 118 | |
| 119 | |
| 120 | // if(frameCount % 5==0 ){ |
| 121 | // |
| 122 | // levelNumber = (levelNumber +1)%43; |
| 123 | // } |
| 124 | // image(backgroundImage,0,0); |
| 125 | // if (!creatingLines) { |
| 126 | |
| 127 | // if (!placingPlayer || playerPlaced) { |
| 128 | // |
| 129 | // player.Update(); |
| 130 | // player.Show(); |
| 131 | // } |
| 132 | // } else { |
| 133 | // image(levelImages[levelNumber], 0, 0) |
| 134 | // } |
| 135 | push() |
| 136 | translate(0, 50); |
| 137 | if (testingSinglePlayer) { |
| 138 | image(levels[player.currentLevelNo].levelImage, 0, 0) |
| 139 | levels[player.currentLevelNo].show(); |
| 140 | player.Update(); |
| 141 | player.Show(); |
| 142 | } else if(replayingBestPlayer) { |
| 143 | if(!cloneOfBestPlayer.hasFinishedInstructions){ |
| 144 | for (let i = 0; i < evolationSpeed; i++){ |
| 145 | cloneOfBestPlayer.Update() |
| 146 | } |
| 147 | |
| 148 | showLevel(cloneOfBestPlayer.currentLevelNo); |
| 149 | alreadyShowingSnow = false; |
| 150 | cloneOfBestPlayer.Show(); |
| 151 | }else{ |
| 152 | replayingBestPlayer = false; |
| 153 | mutePlayers = true; |
| 154 | } |
| 155 | |
| 156 | }else{ |
| 157 | |
| 158 | if (population.AllPlayersFinished()) { |
| 159 | population.NaturalSelection(); |
| 160 | if (population.gen % increaseActionsEveryXGenerations === 0) { |
| 161 | population.IncreasePlayerMoves(increaseActionsByAmount); |
| 162 | } |
| 163 | } |
| 164 | for (let i = 0; i < evolationSpeed; i++) |
| 165 | population.Update() |
| 166 | // population.Update() |
| 167 | // population.Update() |
| 168 | population.Show(); |
| 169 | |
| 170 | } |
| 171 | |
| 172 | |
| 173 | if (showingLines || creatingLines) |
nothing calls this directly
no test coverage detected