-
Notifications
You must be signed in to change notification settings - Fork 16
/
app.js
48 lines (40 loc) · 1.29 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* Controllers for the buttons and variables.
*/
$(function(){
$('.start-genetic-algorithm').click(function(){
$(this).hide();
$('.pause-genetic-algorithm').show();
testGeneticSoylent.autoGenerate = true;
testGeneticSoylent.nextGeneration();
return false;
});
$('.pause-genetic-algorithm').click(function(){
testGeneticSoylent.autoGenerate = false;
$(this).hide();
$('.start-genetic-algorithm').show();
return false;
});
$('.step-genetic-algorithm').click(function(){
testGeneticSoylent.nextGeneration();
return false;
});
$('.reset-genetic-algorithm').click(function(){
testGeneticSoylent.reset();
testGeneticSoylent.render();
return false;
});
$('.death-rate').change(function(){
testGeneticSoylent.deathRate = Number($(this).val());
});
$('.population').change(function(){
testGeneticSoylent.populationSize = Number($(this).val());
});
$('.mutation-probability').change(function(){
testGeneticSoylent.mutationProbability = Number($(this).val());
});
$('.mutation-multiplier').change(function(){
testGeneticSoylent.mutationMultiplier = Number($(this).val());
});
testGeneticSoylent.render();
});