cl-scopes/csys/program/gene.lisp

34 lines
1.2 KiB
Common Lisp

;;;; cl-scopes/csys/program/gene - generic generative (genetic) programs
(defpackage :scopes/csys/program/gene
(:use :common-lisp)
(:local-nicknames (:actor :scopes/core/actor)
(:csys :scopes/csys)
(:environ :scopes/csys/environ)
(:message :scopes/core/message)
(:util :scopes/util))
(:export #:config-g0))
(in-package :scopes/csys/program/gene)
;;;; gene-0: zero-only network for explicit messages and interactive testing
(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)
'(:e00 :initial) (csys:eff-proc :value val-action-e)
':default (csys:std-proc)))))