dennco Project. Sample

Cell Code Class Definitions

Code class:
SampleScript1
API TYPE:
TKJSBasicCell
        
        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);
        
        }
        
        
Code class2:
SampleScript2
API TYPE2:
TKJSBasicCell
                
        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;
                
        }
                
        

Cells (Neurons)

Cell Name:
cell1-1
Code class:
SampleScript1
Init Script:
            
    // init code here    
                
Connections:
cell2-1 cell2-2
Cell name : cell1-2
Code class :
SampleScript1
            
    // init code here    
        
Connections:
Cell name : cell1-3
Code class :
SampleScript1
            
    // init code here    
        
Cell name : cell2-1
Code class :
SampleScript2
                
                positiveInputs = {FQN("/sample.html#cell1-1"), FQN("sample2.html#cell1-2")};
                negativeInputs = {FQN("../sample3.html#cell1-3")}    
            
Connections:
Cell name : cell2-2
Code class :
SampleScript2
                
    positiveInputs = {FQN("cell1-3")};
    negativeInputs = {FQN("../cell1-1"), FQN("cell1-2")}    
            
Connections:
Cell name : cell3-1
Code class :
SampleScript2
        
    positiveInputs = {FQN("cell2-1")};
    negativeInputs = {FQN("cell2-2")}