3c9facf27dea

Clean up next-iset computation API
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sat, 25 Feb 2017 16:17:01 +0000
parents a11739a2b4ef
children 016dd6d5f764
branches/tags (none)
files src/reasoners/zdd.lisp

Changes

--- a/src/reasoners/zdd.lisp	Fri Feb 24 15:48:20 2017 +0000
+++ b/src/reasoners/zdd.lisp	Sat Feb 25 16:17:01 2017 +0000
@@ -301,6 +301,12 @@
     (zdd-match iset moves universe)))
 
 
+(defun compute-next-iset (reasoner iset)
+  (-<> iset
+    (zdd-meet <> (zr-next-zdd *r*))
+    (convert-next-to-true *r* <>)))
+
+
 ;;;; Drawing ------------------------------------------------------------------
 (defun label (reasoner n)
   (let ((*package* (find-package :ggp-rules)))
@@ -544,42 +550,40 @@
 (defparameter *r* (make-zdd-reasoner *rules*))
 (defparameter *i* (initial-iset *r*))
 
-;; (defun test ()
-;;   (with-zdd
-;;     (-<>
-;;         (initial-iset *r*)
+(defun test ()
+  (with-zdd
+    (-<>
+        (initial-iset *r*)
 
-;;       (apply-rule-forest *r* <> (zr-possible-forest *r*))
-;;       (sprout *r* <>)
-;;       (apply-rule-forest *r* <> (zr-happens-forest *r*))
-;;       (filter-iset-for-percepts
-;;         *r* <>
-;;         'ggp-rules::alice
-;;         '((ggp-rules::sees ggp-rules::alice (ggp-rules::coins ggp-rules::unset))))
-;;       (filter-iset-for-move
-;;          *r* <>
-;;         'ggp-rules::alice
-;;         'ggp-rules::noop)
-;;       (zdd-meet <> (zr-next-zdd *r*))
-;;       (convert-next-to-true *r* <>)
+      (apply-rule-forest *r* <> (zr-possible-forest *r*))
+      (sprout *r* <>)
+      (apply-rule-forest *r* <> (zr-happens-forest *r*))
+      (filter-iset-for-percepts
+        *r* <>
+        'ggp-rules::alice
+        '((ggp-rules::sees ggp-rules::alice (ggp-rules::coins ggp-rules::unset))))
+      (filter-iset-for-move
+         *r* <>
+        'ggp-rules::alice
+        'ggp-rules::noop)
+      (compute-next-iset *r* <>)
 
-;;       (apply-rule-forest *r* <> (zr-possible-forest *r*))
-;;       (sprout *r* <>)
-;;       (apply-rule-forest *r* <> (zr-happens-forest *r*))
-;;       (filter-iset-for-move
-;;          *r* <>
-;;         'ggp-rules::alice
-;;         '(ggp-rules::play ggp-rules::tails))
-;;       (filter-iset-for-percepts
-;;         *r* <>
-;;         'ggp-rules::alice
-;;         '((ggp-rules::sees ggp-rules::alice (ggp-rules::coins ggp-rules::heads))))
-;;       (zdd-meet <> (zr-next-zdd *r*))
-;;       (convert-next-to-true *r* <>)
+      (apply-rule-forest *r* <> (zr-possible-forest *r*))
+      (sprout *r* <>)
+      (apply-rule-forest *r* <> (zr-happens-forest *r*))
+      (filter-iset-for-move
+         *r* <>
+        'ggp-rules::alice
+        '(ggp-rules::play ggp-rules::tails))
+      (filter-iset-for-percepts
+        *r* <>
+        'ggp-rules::alice
+        '((ggp-rules::sees ggp-rules::alice (ggp-rules::coins ggp-rules::heads))))
+      (compute-next-iset *r* <>)
 
-;;       (apply-rule-forest *r* <> (zr-possible-forest *r*))
+      (apply-rule-forest *r* <> (zr-possible-forest *r*))
 
-;;       (dump-iset *r* <>)
-;;       (no <>)
-;;       ; (draw-zdd *r* <>)
-;;       )))
+      (dump-iset *r* <>)
+      (no <>)
+      ; (draw-zdd *r* <>)
+      )))