diff --git a/csys/environ.lisp b/csys/environ.lisp index 1d23edc..04d689a 100644 --- a/csys/environ.lisp +++ b/csys/environ.lisp @@ -76,7 +76,7 @@ :default (csys:no-op :no-forward t))) (defun cell-created (msg scope) - (util:lgw "debug" msg scope) + ;(util:lgw "debug" msg scope) (let* ((data (shape:data msg)) (addr (getf data :addr)) (new (getf data :new))) @@ -86,7 +86,8 @@ (ct (find-cell scope ct-addr :no-warn t))) (when ct (csys:send-connect new ct))) (csys:send-message new (list (message:domain msg) :next) data) - nil)) + msg)) + ;nil)) (defun forward (msg scope) (let ((rcvr (or (actor:customer msg) @@ -100,12 +101,13 @@ (head (shape:head msg)) (data (shape:data msg)) (dom (car head)) - (cat (getf data :cat)) - (spc (getf (spaces scope) dom))) + (cat (getf data :cat :c00)) + (spc (getf (spaces scope) dom)) + loc-new) (unless addr (setf addr (gethash rcvr (cells scope)))) - ;(util:plist-add data :loc (car (space:free-loc-at spc (caddr addr)))) - (util:plist-add data :addr (list dom cat (car (space:free-loc-at spc (caddr addr))))) + (setf loc-new (car (space:free-loc-at spc (caddr addr)))) + (util:plist-add data :addr (list dom cat loc-new)) (csys:send-message rcvr head data)) nil) diff --git a/csys/program/gene.lisp b/csys/program/gene.lisp index f0895ca..9609b1d 100644 --- a/csys/program/gene.lisp +++ b/csys/program/gene.lisp @@ -1,4 +1,4 @@ -;;;; cl-scopes/csys/program/gene - generative / genetic programs +;;;; cl-scopes/csys/program/gene - generic generative (genetic) programs (defpackage :scopes/csys/program/gene (:use :common-lisp) @@ -7,18 +7,28 @@ (:environ :scopes/csys/environ) (:message :scopes/core/message) (:util :scopes/util)) - (:export #:prog-g0)) + (:export #:config-g0)) (in-package :scopes/csys/program/gene) ;;;; gene-0: zero-only network for explicit messages and interactive testing -(defun prog-g0 () - (let ((val-action (csys:value-add))) +(defun config-g0 () + (let* ((ops (list :inhibit (csys:multiply -1))) + (std (list :bias 0 :cat :c00 :ops ops)) + (eff (list :bias 2)) + (cfg (list :std std :eff eff))) + (list (prog-g0 cfg) :std std + :contacts '(:e00 (#(1 0) #(1 1)))))) + +(defun prog-g0 (cfg) + (let* ((std (getf cfg :std)) + (eff (getf cfg :eff)) + (bias-e (getf eff :bias 0)) + (threshold-e (getf eff :threshold 1)) + (val-action-e (csys:value-add :bias bias-e :threshold threshold-e))) (csys:make-program - (list '(:c00 :initial) (csys:std-proc :value val-action) - '(:e00 :initial) (csys:eff-proc) + (list '(:c00 :initial) (csys:std-proc) + '(:e00 :initial) (csys:eff-proc :value val-action-e) ':default (csys:std-proc))))) - - diff --git a/test/test-csys.lisp b/test/test-csys.lisp index 193890e..57561c6 100644 --- a/test/test-csys.lisp +++ b/test/test-csys.lisp @@ -127,9 +127,11 @@ (teardown))) (deftest test-gene-0 () - (let ((environ:*env* (setup (list (gene:prog-g0)))) + (let ((environ:*env* (setup (gene:config-g0))) (rcvr (tc:receiver t:*test-suite*))) - (environ:send-create '(:csys :c00 #(0 0)) :cat :e01 :connect :succ) + (environ:send-create '(:csys :c00 #(0 0)) :cat :e00 :connect :succ) + (sleep 0.01) + (environ:send-value '(:c00 #(0 0)) 2) (sleep 0.01) (print (tc:collected rcvr)) (teardown)))