function doTick(time) { print("JavaScript doTick called. time:" + time); var val = 0; var len = 0; for (var key in this.cell.receptors) { print("JS script... key:" + key + " value:" + this.cell.receptors[key]); val += this.cell.receptors[key] + 5; len++; } val = val / len; this.cell.setAxonValue(val); }
var positiveInputs; var negativeInputs; var maxValue = 100.0; var minValue = -100.0; function doTick(time) { print("JavaScript doTick called. time:" + time); var pval = 0; var nval = 0; var len = 0; var key; for (key in this.positiveInputs) { print("Positive input:" + key + " value:" + this.cell.receptors[key]); pval += this.cell.receptors[key]; len++; } pval = pval / len; len = 0; for (key in this.negativeInputs) { print("Negative input:" + key + " value:" + this.cell.receptors[key]); nval += this.cell.receptors[key]; len++; } nval = nval / len; var t = this.cell.getAxonValue(); if (t > maxValue) t = maxValue; else if (t < minValue) t = minValue; this.cell.axonValue = t; }
// init code here
positiveInputs = {FQN("/sample.html#cell1-1"), FQN("sample2.html#cell1-2")}; negativeInputs = {FQN("../sample3.html#cell1-3")}Connections:
positiveInputs = {FQN("cell1-3")}; negativeInputs = {FQN("../cell1-1"), FQN("cell1-2")}Connections:
positiveInputs = {FQN("cell2-1")}; negativeInputs = {FQN("cell2-2")}