Advertisement
Houshalter

Untitled

May 13th, 2015
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. var storeGene = []
  2. for (var j = 0; j < initGene.length; j++){
  3.  
  4. storeGene[j] = initGene[j];
  5. print(storeGene[j])
  6. }
  7.  
  8.  
  9.  
  10. function mutate(r){
  11. var newGene = initGene;
  12. for (var j = 0; j < initGene.length; j++){
  13.  
  14. newGene[j] = r*(Math.random()*2-1)*storeGene[j]+storeGene[j];
  15. }
  16.  
  17. var newChromosome = new convnetjs.Chromosome(newGene);
  18. game.agent2.brain.populate(newChromosome);
  19. game.agent1.brain.populate(newChromosome);
  20. }
  21. mutate(0.11)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement