Merge pull request #46 from MaxRobinsonTheGreat/mut-rate-editor
Mutation rate editor
This commit is contained in:
4
dist/index.html
vendored
4
dist/index.html
vendored
@@ -143,6 +143,10 @@
|
|||||||
<label for="move-range-edit" title='The number of cells to move before randomly changing direction. Overriden by brain decisions.'>Move Range:</label>
|
<label for="move-range-edit" title='The number of cells to move before randomly changing direction. Overriden by brain decisions.'>Move Range:</label>
|
||||||
<input type="number" id="move-range-edit" min="1" max="100" value=3 step="1">
|
<input type="number" id="move-range-edit" min="1" max="100" value=3 step="1">
|
||||||
</div>
|
</div>
|
||||||
|
<div id='mutation-rate-cont'>
|
||||||
|
<label for="mutation-rate-edit" title='Probability that offspring of this organism will mutate'>Mutation Rate:</label>
|
||||||
|
<input type="number" id="mutation-rate-edit" min="1" max="100" value=3 step="1">
|
||||||
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<div class='brain-details'>
|
<div class='brain-details'>
|
||||||
<h4>Brain</h4>
|
<h4>Brain</h4>
|
||||||
|
|||||||
@@ -143,9 +143,12 @@ class ControlPanel {
|
|||||||
$(tab).css('display', 'grid');
|
$(tab).css('display', 'grid');
|
||||||
self.engine.organism_editor.is_active = (this.id == 'editor');
|
self.engine.organism_editor.is_active = (this.id == 'editor');
|
||||||
self.stats_panel.stopAutoRender();
|
self.stats_panel.stopAutoRender();
|
||||||
if (this.id == 'stats') {
|
if (this.id === 'stats') {
|
||||||
self.stats_panel.startAutoRender();
|
self.stats_panel.startAutoRender();
|
||||||
}
|
}
|
||||||
|
else if (this.id === 'editor') {
|
||||||
|
self.editor_controller.refreshDetailsPanel();
|
||||||
|
}
|
||||||
self.tab_id = this.id;
|
self.tab_id = this.id;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,6 +93,10 @@ class EditorController extends CanvasController{
|
|||||||
$('#move-range-edit').change ( function() {
|
$('#move-range-edit').change ( function() {
|
||||||
this.env.organism.move_range = parseInt($('#move-range-edit').val());
|
this.env.organism.move_range = parseInt($('#move-range-edit').val());
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
|
$('#mutation-rate-edit').change ( function() {
|
||||||
|
this.env.organism.mutability = parseInt($('#mutation-rate-edit').val());
|
||||||
|
}.bind(this));
|
||||||
$('#observation-type-edit').change ( function() {
|
$('#observation-type-edit').change ( function() {
|
||||||
this.setBrainEditorValues($('#observation-type-edit').val());
|
this.setBrainEditorValues($('#observation-type-edit').val());
|
||||||
this.setBrainDetails();
|
this.setBrainDetails();
|
||||||
@@ -110,6 +114,13 @@ class EditorController extends CanvasController{
|
|||||||
$('#edit-organism-details').css('display', 'none');
|
$('#edit-organism-details').css('display', 'none');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
refreshDetailsPanel() {
|
||||||
|
if (this.mode === Modes.Edit)
|
||||||
|
this.setEditorPanel();
|
||||||
|
else
|
||||||
|
this.setDetailsPanel();
|
||||||
|
}
|
||||||
|
|
||||||
setDetailsPanel() {
|
setDetailsPanel() {
|
||||||
this.clearDetailsPanel();
|
this.clearDetailsPanel();
|
||||||
var org = this.env.organism;
|
var org = this.env.organism;
|
||||||
@@ -117,6 +128,7 @@ class EditorController extends CanvasController{
|
|||||||
$('.cell-count').text("Cell count: "+org.anatomy.cells.length);
|
$('.cell-count').text("Cell count: "+org.anatomy.cells.length);
|
||||||
$('#move-range').text("Move Range: "+org.move_range);
|
$('#move-range').text("Move Range: "+org.move_range);
|
||||||
$('#mutation-rate').text("Mutation Rate: "+org.mutability);
|
$('#mutation-rate').text("Mutation Rate: "+org.mutability);
|
||||||
|
|
||||||
if (Hyperparams.useGlobalMutability) {
|
if (Hyperparams.useGlobalMutability) {
|
||||||
$('#mutation-rate').css('display', 'none');
|
$('#mutation-rate').css('display', 'none');
|
||||||
}
|
}
|
||||||
@@ -142,6 +154,14 @@ class EditorController extends CanvasController{
|
|||||||
$('#move-range-edit').val(org.move_range);
|
$('#move-range-edit').val(org.move_range);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('#mutation-rate-edit').val(org.mutability);
|
||||||
|
if (Hyperparams.useGlobalMutability) {
|
||||||
|
$('#mutation-rate-cont').css('display', 'none');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('#mutation-rate-cont').css('display', 'block');
|
||||||
|
}
|
||||||
|
|
||||||
if (this.setBrainPanelVisibility()){
|
if (this.setBrainPanelVisibility()){
|
||||||
this.setBrainEditorValues($('#observation-type-edit').val());
|
this.setBrainEditorValues($('#observation-type-edit').val());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,8 +105,4 @@ class Renderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// $("body").mousemove(function(e) {
|
|
||||||
// console.log("hello");
|
|
||||||
// });
|
|
||||||
|
|
||||||
module.exports = Renderer;
|
module.exports = Renderer;
|
||||||
|
|||||||
Reference in New Issue
Block a user