亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? electrnc.clp

?? 一個(gè)有關(guān)專家系統(tǒng)的CLISP 源代碼
?? CLP
字號(hào):
;;;======================================================
;;;   Circuit Input/Output Simplification Expert System
;;;
;;;     This program simplifies the boolean decision 
;;;     table for a circuit consisting of inputs (SOURCES) 
;;;     and outputs (LEDs). 
;;;
;;;     The simplification procedure works as follows:
;;;     1) The connections between components of the
;;;        circuit are initialized.
;;;     2) The response of the circuit when all SOURCEs
;;;        are set to zero is determined.
;;;     3) Source input values are changed one at a time
;;;        and the response of the circuit is determined.
;;;        All possible input combinations are iterated
;;;        through using a gray code (a number representation
;;;        system using binary digits in which successive
;;;        integers differ by exactly one binary digit).
;;;        For example, the gray code for the numbers 0 to 7
;;;        is 0 = 000, 1 = 001, 2 = 011, 3 = 010, 4 = 110,
;;;        5 = 111, 6 = 101, 7 = 100. By using a gray code,
;;;        only one SOURCE has to be changed at a time to
;;;        determine the next response in the decision 
;;;        table (minimizing execution time).
;;;     4) As responses are determined, a rule checks to
;;;        see if any two sets of inputs with the same
;;;        response differ if a single input. If so, then
;;;        the single input can be replaced with a * 
;;;        (indicating that it does not matter what the
;;;        value of the input is given the other inputs).
;;;        For example,  if the input 0 1 0 gave a response
;;;        of 1 0 and the input 0 0 0 gave the same response,
;;;        then the decision table can be simplified by
;;;        indicating that 0 * 0 gives a response of 1 0.
;;;     5) Once all responses and simplifications have been
;;;        determined, the decision table for the circuit is
;;;        printed.
;;;        
;;;     This example illustrates the use of most of the
;;;     constructs available in CLIPS 6.0 and also shows how
;;;     COOL can be effectively integrated with rules.
;;;     Generic functions are used to connect the components
;;;     of the circuit during initialization. Classes,
;;;     message-handlers, and deffunctions are used to
;;;     determine the response of the circuit to a set of
;;;     inputs. Rules, deffunctions, and global variables
;;;     are used to control execution, iterate through all
;;;     possible input combinations, simplify the boolean
;;;     decision tree, and print out the simplified decision
;;;     tree.
;;;
;;;     CLIPS Version 6.0 Example
;;; 
;;;     To execute, load this file, load one of the circuit
;;;     files (circuit1.clp, circuit2.clp, or circuit3.clp), 
;;;     reset, and run.
;;;======================================================


;;;***********
;;; DEFCLASSES
;;;***********

(defclass COMPONENT
  (is-a USER)
  (slot ID# (create-accessor write)))

(defclass NO-OUTPUT
  (is-a USER)
  (slot number-of-outputs (access read-only) 
                          (default 0)
                          (create-accessor read)))

(defmessage-handler NO-OUTPUT compute-output ())

(defclass ONE-OUTPUT
  (is-a NO-OUTPUT)
  (slot number-of-outputs (access read-only) 
                          (default 1)
                          (create-accessor read))
  (slot output-1 (default UNDEFINED) (create-accessor write))
  (slot output-1-link (default GROUND) (create-accessor write))
  (slot output-1-link-pin (default 1) (create-accessor write)))

(defmessage-handler ONE-OUTPUT put-output-1 after (?value)
   (send ?self:output-1-link 
         (sym-cat put-input- ?self:output-1-link-pin)
         ?value))

(defclass TWO-OUTPUT
  (is-a ONE-OUTPUT)
  (slot number-of-outputs (access read-only) 
                          (default 2)
                          (create-accessor read))
  (slot output-2 (default UNDEFINED) (create-accessor write))
  (slot output-2-link (default GROUND) (create-accessor write))
  (slot output-2-link-pin (default 1) (create-accessor write)))

(defmessage-handler TWO-OUTPUT put-output-1 after (?value)
   (send ?self:output-2-link 
         (sym-cat put-input- ?self:output-2-link-pin)
         ?value))

(defclass NO-INPUT
  (is-a USER)
  (slot number-of-inputs (access read-only) 
                         (default 0)
                         (create-accessor read)))

(defclass ONE-INPUT
  (is-a NO-INPUT)
  (slot number-of-inputs (access read-only) 
                         (default 1)
                         (create-accessor read))
  (slot input-1 (default UNDEFINED) 
                (visibility public)
                (create-accessor read-write))
  (slot input-1-link (default GROUND) (create-accessor write))
  (slot input-1-link-pin (default 1) (create-accessor write)))

(defmessage-handler ONE-INPUT put-input-1 after (?value)
   (send ?self compute-output))

(defclass TWO-INPUT
  (is-a ONE-INPUT)
  (slot number-of-inputs (access read-only) 
                         (default 2)
                         (create-accessor read))
  (slot input-2 (default UNDEFINED) 
                (visibility public)
                (create-accessor write))
  (slot input-2-link (default GROUND) (create-accessor write))
  (slot input-2-link-pin (default 1) (create-accessor write)))

(defmessage-handler TWO-INPUT put-input-2 after (?value)
   (send ?self compute-output))
 
(defclass SOURCE
  (is-a NO-INPUT ONE-OUTPUT COMPONENT)
  (role concrete)
  (slot output-1 (default UNDEFINED) (create-accessor write)))

(defclass SINK
  (is-a ONE-INPUT NO-OUTPUT COMPONENT)
  (role concrete)
  (slot input-1 (default UNDEFINED) (create-accessor read-write)))

;;;*******************
;;; NOT GATE COMPONENT
;;;*******************

(defclass NOT-GATE
  (is-a ONE-INPUT ONE-OUTPUT COMPONENT)
  (role concrete))

(deffunction not# (?x) (- 1 ?x))

(defmessage-handler NOT-GATE compute-output ()
   (if (integerp ?self:input-1) then
       (send ?self put-output-1 (not# ?self:input-1))))

;;;*******************
;;; AND GATE COMPONENT
;;;*******************

(defclass AND-GATE
  (is-a TWO-INPUT ONE-OUTPUT COMPONENT)
  (role concrete))

(deffunction and# (?x ?y) 
  (if (and (!= ?x 0) (!= ?y 0)) then 1 else 0))

(defmessage-handler AND-GATE compute-output ()
   (if (and (integerp ?self:input-1) 
            (integerp ?self:input-2)) then
       (send ?self put-output-1 (and# ?self:input-1 ?self:input-2))))

;;;******************
;;; OR GATE COMPONENT
;;;******************

(defclass OR-GATE
  (is-a TWO-INPUT ONE-OUTPUT COMPONENT)
  (role concrete))

(deffunction or# (?x ?y) 
  (if (or (!= ?x 0) (!= ?y 0)) then 1 else 0))

(defmessage-handler OR-GATE compute-output ()
   (if (and (integerp ?self:input-1) 
            (integerp ?self:input-2)) then
       (send ?self put-output-1 (or# ?self:input-1 ?self:input-2))))

;;;********************
;;; NAND GATE COMPONENT
;;;********************

(defclass NAND-GATE
  (is-a TWO-INPUT ONE-OUTPUT COMPONENT)
  (role concrete))

(deffunction nand# (?x ?y) 
  (if (not (and (!= ?x 0) (!= ?y 0))) then 1 else 0))

(defmessage-handler NAND-GATE compute-output ()
   (if (and (integerp ?self:input-1) 
            (integerp ?self:input-2)) then
       (send ?self put-output-1 (nand# ?self:input-1 ?self:input-2))))

;;;*******************
;;; XOR GATE COMPONENT
;;;*******************

(defclass XOR-GATE
  (is-a TWO-INPUT ONE-OUTPUT COMPONENT)
  (role concrete))

(deffunction xor# (?x ?y) 
  (if (or (and (= ?x 1) (= ?y 0))
          (and (= ?x 0) (= ?y 1))) then 1 else 0))

(defmessage-handler XOR-GATE compute-output ()
   (if (and (integerp ?self:input-1) 
            (integerp ?self:input-2)) then
       (send ?self put-output-1 (xor# ?self:input-1 ?self:input-2))))

;;;*******************
;;; SPLITTER COMPONENT
;;;*******************

(defclass SPLITTER
  (is-a ONE-INPUT TWO-OUTPUT COMPONENT)
  (role concrete))

(defmessage-handler SPLITTER compute-output ()
   (if (integerp ?self:input-1) then
       (send ?self put-output-1 ?self:input-1)
       (send ?self put-output-2 ?self:input-1)))

;;;**************
;;; LED COMPONENT
;;;**************

(defclass LED
  (is-a ONE-INPUT NO-OUTPUT COMPONENT)
  (role concrete))

;;; Returns the current value of each LED 
;;; instance in a multifield value.
(deffunction LED-response ()
   (bind ?response (create$))
   (do-for-all-instances ((?led LED)) TRUE
      (bind ?response (create$ ?response (send ?led get-input-1))))
   ?response)

;;;***************************
;;; DEFGENERICS AND DEFMETHODS
;;;***************************

(defgeneric connect)

;;; Connects a one output component to a one input component.
(defmethod connect ((?out ONE-OUTPUT) (?in ONE-INPUT)) 
   (send ?out put-output-1-link ?in) 
   (send ?out put-output-1-link-pin 1)
   (send ?in  put-input-1-link ?out)
   (send ?in  put-input-1-link-pin 1))

;;; Connects a one output component to one pin of a two input component.
(defmethod connect ((?out ONE-OUTPUT) (?in TWO-INPUT) (?in-pin INTEGER)) 
   (send ?out put-output-1-link ?in)
   (send ?out put-output-1-link-pin ?in-pin)
   (send ?in  (sym-cat put-input- ?in-pin -link) ?out)
   (send ?in  (sym-cat put-input- ?in-pin -link-pin) 1))

;;; Connects one pin of a two output component to a one input component.
(defmethod connect ((?out TWO-OUTPUT) (?out-pin INTEGER) (?in ONE-INPUT)) 
   (send ?out (sym-cat put-output- ?out-pin -link) ?in)
   (send ?out (sym-cat put-output- ?out-pin -link-pin) 1)
   (send ?in put-input-1-link ?out)
   (send ?in put-input-1-link-pin ?out-pin))

;;; Connects one pin of a two output component 
;;; to one pin of a two input component.
(defmethod connect ((?out TWO-OUTPUT) (?out-pin INTEGER)
                    (?in TWO-INPUT) (?in-pin INTEGER)) 
   (send ?out (sym-cat put-output- ?out-pin -link) ?in)
   (send ?out (sym-cat put-output- ?out-pin -link-pin) ?in-pin)
   (send ?in  (sym-cat put-input- ?in-pin -link) ?out)
   (send ?in  (sym-cat put-input- ?in-pin -link-pin) ?out-pin))

;;;****************************
;;; DEFGLOBALS AND DEFFUNCTIONS 
;;;****************************

(defglobal ?*gray-code* = (create$)
           ?*sources* = (create$)
           ?*max-iterations* = 0)

;;; Given the current iteration, determines the next 
;;; bit in the gray code to change. 
;;; Algorithm courtesy of John R. Kennedy (The BitMan).
(deffunction change-which-bit (?x)
   (bind ?i 1)
   (while (and (evenp ?x) (!= ?x 0)) do 
      (bind ?x (div ?x 2))
      (bind ?i (+ ?i 1)))
   ?i)

;;; Forward declaration since the initial configuration
;;; is stored in a separate file.
(deffunction connect-circuit ())

;;;*********
;;; DEFRULES
;;;*********

(defrule startup
  =>
  ;; Initialize the circuit by connecting the components
  (connect-circuit) 
  ;; Setup the globals. 
  (bind ?*sources* (find-all-instances ((?x SOURCE)) TRUE))
  (do-for-all-instances ((?x SOURCE)) TRUE
     (bind ?*gray-code* (create$ ?*gray-code* 0)))
  (bind ?*max-iterations* (round (** 2 (length ?*sources*))))
  ;; Do the first response.
  (assert (current-iteration 0)))

(defrule compute-response-1st-time
   ?f <- (current-iteration 0)
   =>
   ;; Set all of the sources to zero.
   (do-for-all-instances ((?source SOURCE)) TRUE (send ?source put-output-1 0))
   ;; Determine the initial LED response.
   (assert (result ?*gray-code* =(str-implode (LED-response))))
   ;; Begin the iteration process of looping through the gray code combinations.
   (retract ?f)
   (assert (current-iteration 1)))

(defrule compute-response-other-times
   ?f <- (current-iteration ?n&~0&:(< ?n ?*max-iterations*))
   =>
   ;; Change the gray code, saving the changed bit value.
   (bind ?pos (change-which-bit ?n))
   (bind ?nv (- 1 (nth ?pos ?*gray-code*)))
   (bind ?*gray-code* (replace$ ?*gray-code* ?pos ?pos ?nv))
   ;; Change the single changed source
   (send (nth ?pos ?*sources*) put-output-1 ?nv)   
   ;; Determine the LED response to the input.
   (assert (result ?*gray-code* =(str-implode (LED-response))))
   ;; Assert the new iteration fact
   (retract ?f)
   (assert (current-iteration =(+ ?n 1))))

(defrule merge-responses
   (declare (salience 10))
   ?f1 <- (result $?b  ?x $?e ?response)
   ?f2 <- (result $?b ~?x $?e ?response)
   =>
   (retract ?f1 ?f2)
   (assert (result $?b * $?e ?response)))

(defrule print-header
   (declare (salience -10))
   =>
   (assert (print-results))
   (do-for-all-instances ((?x SOURCE)) TRUE (format t " %3s " (sym-cat ?x)))
   (printout t " | ")
   (do-for-all-instances ((?x LED)) TRUE (format t " %3s " (sym-cat ?x)))
   (format t "%n")
   (do-for-all-instances ((?x SOURCE)) TRUE (printout t "-----"))
   (printout t "-+-")
   (do-for-all-instances ((?x LED)) TRUE (printout t "-----"))
   (format t "%n"))
      
(defrule print-result
   (print-results)
   ?f <- (result $?input ?response)
   (not (result $?input-2 ?response-2&:(< (str-compare ?response-2 ?response) 0)))
   =>
   (retract ?f)
   ;; Print the input from the sources.
   (while (neq ?input (create$)) do
      (printout t "  " (nth 1 ?input) "  ")
      (bind ?input (rest$ ?input)))
   ;; Print the output from the LEDs.
   (printout t " | ")
   (bind ?response (str-explode ?response))
   (while (neq ?response (create$)) do
      (printout t "  " (nth 1 ?response) "  ")
      (bind ?response (rest$ ?response)))
   (printout t crlf))

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久不见久久见免费视频7| 国产一区二区三区久久悠悠色av| 日韩欧美亚洲另类制服综合在线| av在线播放不卡| 另类欧美日韩国产在线| 亚洲精品免费电影| 欧美国产日产图区| 日韩美女视频在线| 欧美日韩一区二区三区四区 | 天天综合色天天综合| 国产婷婷色一区二区三区 | 欧美丝袜丝nylons| 播五月开心婷婷综合| 黑人巨大精品欧美一区| 午夜激情一区二区| 亚洲一区二区欧美日韩| 亚洲日本电影在线| 国产精品婷婷午夜在线观看| 日韩精品一区在线| 欧美日韩一区二区三区在线看| 99视频热这里只有精品免费| 国产精品自拍一区| 国内成人免费视频| 日韩国产精品91| 丝袜亚洲另类欧美综合| 亚洲国产精品人人做人人爽| 亚洲欧美成aⅴ人在线观看| 国产三级精品视频| 国产视频在线观看一区二区三区| 欧美成人一区二区三区在线观看 | 欧美激情一区二区三区不卡 | 狠狠色狠狠色综合日日91app| 午夜激情综合网| 午夜婷婷国产麻豆精品| 亚洲一区在线观看免费观看电影高清| 亚洲色图另类专区| 亚洲精品视频免费看| 亚洲欧洲精品一区二区三区不卡| 亚洲国产精品精华液2区45| 国产亚洲欧洲一区高清在线观看| 26uuu亚洲综合色| 精品国免费一区二区三区| 日韩欧美一级精品久久| 日韩精品一区二区三区视频播放 | 在线观看成人小视频| 日本二三区不卡| 欧洲精品在线观看| 欧美日韩一区二区三区视频 | 国产精品久久久久久久久搜平片| 中文字幕欧美激情一区| 美国毛片一区二区| 日韩电影在线观看电影| av在线这里只有精品| 亚洲欧美日韩国产另类专区| 亚洲情趣在线观看| 一级精品视频在线观看宜春院 | 欧美激情综合网| 国产精品九色蝌蚪自拍| 亚洲一区二区中文在线| 日本不卡一区二区三区 | 丁香亚洲综合激情啪啪综合| 国产成人精品一区二| 99国产欧美久久久精品| 一本到不卡免费一区二区| 在线成人免费视频| 久久精品一区二区三区不卡| 综合久久国产九一剧情麻豆| 亚洲一区二区三区在线看| 另类中文字幕网| www.66久久| 欧美一区二区三区婷婷月色| 国产亚洲污的网站| 亚洲一区二区精品视频| 激情深爱一区二区| 91免费观看视频在线| 欧美一区三区四区| 日本一区二区高清| 亚洲国产成人精品视频| 精品一区二区三区不卡 | 国产一区二区在线影院| 99久久99久久综合| 日韩一区二区三区电影 | 国产精品成人网| 亚洲国产三级在线| 粉嫩嫩av羞羞动漫久久久| 欧美综合一区二区| 久久久99精品免费观看| 亚洲动漫第一页| 成人动漫av在线| 欧美一级片在线| 亚洲欧美韩国综合色| 精品在线观看视频| 欧美性受极品xxxx喷水| 欧美激情一区二区三区| 老司机精品视频线观看86| 色婷婷av久久久久久久| 国产午夜精品一区二区| 日韩成人av影视| 在线观看日韩av先锋影音电影院| 26uuu精品一区二区在线观看| 一区二区在线免费| 高清av一区二区| 精品乱人伦一区二区三区| 亚洲成人动漫在线免费观看| 99久久久精品免费观看国产蜜| 日韩三级视频在线看| 亚洲综合图片区| 97国产一区二区| 国产亚洲精品精华液| 免费日本视频一区| 欧美日韩精品三区| 一区二区三区精品在线| av不卡一区二区三区| 国产欧美一区二区三区网站| 美洲天堂一区二卡三卡四卡视频| 在线观看国产精品网站| 亚洲品质自拍视频| 99久久婷婷国产| 国产精品久久久久婷婷二区次| 国产一区欧美日韩| 2020国产精品自拍| 日本网站在线观看一区二区三区| 欧美性xxxxxxxx| 亚洲高清不卡在线观看| 欧美亚洲国产一区二区三区| 依依成人精品视频| 色婷婷亚洲婷婷| 亚洲激情五月婷婷| 在线观看亚洲专区| 亚洲国产精品久久久久秋霞影院| 在线一区二区视频| 亚洲一区二区视频在线| 欧美三级三级三级爽爽爽| 亚洲一区二区三区四区在线观看 | 久久只精品国产| 国产一区二区三区久久久| 欧美精品一区二区三区蜜臀| 美女视频黄频大全不卡视频在线播放| 91精品啪在线观看国产60岁| 日韩黄色小视频| 精品欧美乱码久久久久久1区2区 | 狠狠狠色丁香婷婷综合久久五月| 欧美一区午夜视频在线观看| 奇米在线7777在线精品 | 久久久久久99精品| 成人自拍视频在线| 亚洲人成网站精品片在线观看| 日本韩国精品在线| 天天操天天色综合| 精品免费国产二区三区| 国产乱子轮精品视频| 国产欧美一区二区精品性| 99久久精品国产精品久久| 一区二区三区高清在线| 日韩一区二区免费在线观看| 国产在线观看一区二区| 国产精品久久久久久福利一牛影视 | 国产精品高清亚洲| 欧美日韩一区高清| 激情五月激情综合网| 日本一区二区三区国色天香 | 色婷婷综合久久久久中文一区二区| 一区二区三区91| 日韩区在线观看| 国产成人精品免费一区二区| 亚洲男人的天堂一区二区| 欧美精品在线一区二区| 国产成人综合网| 亚洲图片欧美色图| 久久精品视频在线免费观看 | 精品国产sm最大网站| 成人高清免费观看| 日韩精品免费专区| 国产精品国产三级国产aⅴ无密码| 欧美中文字幕一区二区三区| 精品一区二区在线视频| 国产精品国产三级国产有无不卡 | 五月婷婷久久综合| 久久久99免费| 欧美性淫爽ww久久久久无| 国产一区不卡视频| 亚洲午夜在线电影| 久久精品水蜜桃av综合天堂| 在线精品视频一区二区| 国产精品1区2区3区在线观看| 一区二区三区欧美亚洲| 久久久久久日产精品| 欧美日韩精品免费| eeuss鲁一区二区三区| 麻豆精品一区二区综合av| 亚洲色图丝袜美腿| 久久久精品免费免费| 6080国产精品一区二区| 99久久99久久精品免费看蜜桃| 六月丁香婷婷久久| 亚洲国产你懂的| 国产精品久久久久久久第一福利| 日韩欧美一二三区| 欧美探花视频资源| 99久久精品免费观看|