Skip to content

Instantly share code, notes, and snippets.



Last active Dec 24, 2015
What would you like to do?
Adapted to clojurescript flavor, derived from
(ns classic-ai-example
(:require-macros [cljs.core.logic.macros :as m])
(:use [cljs.core.logic :only [-take*]]))
(m/defne moveo [before action after]
([[:middle :onbox :middle :hasnot]
[:middle :onbox :middle :has]])
([[pos :onfloor pos has]
[pos :onbox pos has]])
([[pos1 :onfloor pos1 has]
[pos2 :onfloor pos2 has]])
([[pos1 :onfloor box has]
[pos2 :onfloor box has]]))
(m/defne cangeto [state out]
([[_ _ _ :has] true])
([_ _] (m/fresh [action next]
(moveo state action next)
(cangeto next out))))
(m/run 1 [q]
(cangeto [:atdoor :onfloor :atwindow :hasnot] q))) ; (true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.