├── figwheel_server.log ├── .DS_Store ├── src ├── .DS_Store └── pucks │ ├── .DS_Store │ ├── agents │ ├── .DS_Store │ ├── linear.cljc │ ├── user.cljc │ ├── shooter.cljc │ ├── startstop.cljc │ ├── donor.cljc │ ├── torpedo.cljc │ ├── stone.cljc │ ├── generic.cljc │ ├── swarmer.cljc │ ├── spawner.cljc │ ├── zigzag.cljc │ ├── mapdonor.cljc │ ├── zapper.cljc │ ├── opener.cljc │ ├── beacon.cljc │ ├── vent.cljc │ ├── chest.cljc │ └── nursery.cljc │ ├── worlds │ ├── .DS_Store │ ├── dev │ │ ├── .DS_Store │ │ ├── world3.cljc │ │ ├── world2.cljc │ │ ├── world11.cljc │ │ ├── world14.cljc │ │ ├── world18.cljc │ │ ├── world20.cljc │ │ ├── world5.cljc │ │ ├── world4.cljc │ │ ├── world17.cljc │ │ ├── world15.cljc │ │ ├── world21.cljc │ │ ├── world1.cljc │ │ ├── world23.cljc │ │ ├── world22.cljc │ │ ├── world7.cljc │ │ └── world6.cljc │ └── ai │ │ ├── world1.cljc │ │ └── world2.cljc │ ├── draw.cljc │ ├── reap.cljc │ └── sensors.cljc ├── resources ├── .DS_Store └── public │ ├── .DS_Store │ ├── js │ ├── development │ │ ├── cljsc_opts.edn │ │ ├── process │ │ │ ├── env.js.map │ │ │ ├── env.js │ │ │ ├── env.cljs │ │ │ └── env.cljs.cache.json │ │ ├── propeller │ │ │ ├── push │ │ │ │ ├── core.js.map │ │ │ │ ├── utils │ │ │ │ │ ├── globals.js │ │ │ │ │ ├── globals.js.map │ │ │ │ │ └── globals.cljc │ │ │ │ ├── core.cljc │ │ │ │ ├── instructions │ │ │ │ │ ├── bool.cljc.cache.json │ │ │ │ │ ├── character.cljc.cache.json │ │ │ │ │ ├── code.cljc.cache.json │ │ │ │ │ └── string.cljc.cache.json │ │ │ │ ├── core.js │ │ │ │ └── core.cljc.cache.json │ │ │ ├── tools │ │ │ │ ├── character.cljc │ │ │ │ └── character.js.map │ │ │ ├── utils.cljc │ │ │ ├── utils.js.map │ │ │ └── selection.cljc │ │ ├── pucks │ │ │ ├── agents │ │ │ │ ├── linear.cljc │ │ │ │ ├── user.cljc │ │ │ │ ├── user.js.map │ │ │ │ ├── shooter.cljc │ │ │ │ ├── linear.js.map │ │ │ │ ├── shooter.js.map │ │ │ │ ├── startstop.cljc │ │ │ │ ├── startstop.js.map │ │ │ │ ├── donor.cljc │ │ │ │ ├── generic.js.map │ │ │ │ ├── torpedo.cljc │ │ │ │ ├── stone.cljc │ │ │ │ ├── generic.cljc │ │ │ │ ├── swarmer.cljc │ │ │ │ ├── zigzag.js.map │ │ │ │ ├── spawner.js.map │ │ │ │ ├── swarmer.js.map │ │ │ │ ├── user.js │ │ │ │ ├── spawner.cljc │ │ │ │ ├── zigzag.cljc │ │ │ │ ├── mapdonor.cljc │ │ │ │ ├── zapper.cljc │ │ │ │ ├── stone.js.map │ │ │ │ ├── linear.js │ │ │ │ ├── opener.cljc │ │ │ │ ├── startstop.js │ │ │ │ ├── shooter.js │ │ │ │ ├── generic.cljc.cache.json │ │ │ │ ├── beacon.cljc │ │ │ │ ├── beacon.js.map │ │ │ │ ├── vent.cljc │ │ │ │ ├── linear.cljc.cache.json │ │ │ │ ├── user.cljc.cache.json │ │ │ │ ├── chest.cljc │ │ │ │ ├── shooter.cljc.cache.json │ │ │ │ ├── darter.js.map │ │ │ │ └── startstop.cljc.cache.json │ │ │ ├── worlds │ │ │ │ ├── dev │ │ │ │ │ ├── world3.cljc │ │ │ │ │ ├── world2.cljc │ │ │ │ │ ├── world3.js.map │ │ │ │ │ ├── world2.js.map │ │ │ │ │ ├── world11.cljc │ │ │ │ │ ├── world11.js.map │ │ │ │ │ ├── world14.cljc │ │ │ │ │ ├── world18.cljc │ │ │ │ │ ├── world5.js.map │ │ │ │ │ ├── world20.cljc │ │ │ │ │ ├── world5.cljc │ │ │ │ │ ├── world4.cljc │ │ │ │ │ ├── world17.js.map │ │ │ │ │ ├── world17.cljc │ │ │ │ │ ├── world15.cljc │ │ │ │ │ ├── world21.cljc │ │ │ │ │ ├── world1.js.map │ │ │ │ │ ├── world1.cljc │ │ │ │ │ ├── world23.cljc │ │ │ │ │ ├── world22.cljc │ │ │ │ │ ├── world2.js │ │ │ │ │ ├── world7.cljc │ │ │ │ │ ├── world3.js │ │ │ │ │ ├── world3.cljc.cache.json │ │ │ │ │ ├── world5.cljc.cache.json │ │ │ │ │ ├── world4.cljc.cache.json │ │ │ │ │ ├── world11.cljc.cache.json │ │ │ │ │ ├── world17.cljc.cache.json │ │ │ │ │ ├── world2.cljc.cache.json │ │ │ │ │ ├── world18.cljc.cache.json │ │ │ │ │ ├── world10.cljc.cache.json │ │ │ │ │ ├── world14.cljc.cache.json │ │ │ │ │ └── world6.cljc │ │ │ │ └── ai │ │ │ │ │ ├── world1.cljc │ │ │ │ │ ├── world2.cljc │ │ │ │ │ ├── world1.cljc.cache.json │ │ │ │ │ ├── world2.cljc.cache.json │ │ │ │ │ └── world3.cljc.cache.json │ │ │ ├── reap.js.map │ │ │ ├── globals.js.map │ │ │ ├── draw.cljc │ │ │ ├── reap.cljc │ │ │ ├── sensors.js.map │ │ │ ├── draw.cljc.cache.json │ │ │ ├── reap.cljc.cache.json │ │ │ └── sensors.cljc │ │ ├── quil │ │ │ └── middlewares │ │ │ │ └── deprecated_options.cljc │ │ └── goog │ │ │ ├── dom │ │ │ ├── htmlelement.js │ │ │ └── tags.js │ │ │ ├── math │ │ │ └── irect.js │ │ │ └── events │ │ │ └── eventid.js │ ├── optimized │ │ ├── cljsc_opts.edn │ │ ├── process │ │ │ ├── env.js │ │ │ └── env.cljs │ │ ├── propeller │ │ │ ├── push │ │ │ │ ├── utils │ │ │ │ │ ├── globals.js │ │ │ │ │ └── globals.cljc │ │ │ │ ├── core.cljc │ │ │ │ └── core.js │ │ │ ├── tools │ │ │ │ ├── character.cljc │ │ │ │ └── character.js │ │ │ ├── utils.cljc │ │ │ └── selection.cljc │ │ ├── pucks │ │ │ ├── agents │ │ │ │ ├── linear.js │ │ │ │ ├── shooter.js │ │ │ │ └── startstop.js │ │ │ └── worlds │ │ │ │ └── dev │ │ │ │ ├── world2.js │ │ │ │ └── world3.js │ │ ├── quil │ │ │ └── middlewares │ │ │ │ └── deprecated_options.cljc │ │ └── goog │ │ │ ├── dom │ │ │ ├── htmlelement.js │ │ │ └── tags.js │ │ │ ├── math │ │ │ └── irect.js │ │ │ ├── events │ │ │ └── eventid.js │ │ │ └── disposable │ │ │ └── idisposable.js │ └── main.js │ └── style.css ├── .gitignore ├── doc └── intro.md ├── bin └── pucks │ ├── core_test.clj │ ├── worlds │ ├── dev │ │ ├── world3.clj │ │ ├── world2.clj │ │ ├── world5.clj │ │ ├── world4.clj │ │ └── world1.clj │ └── ai │ │ └── world1.clj │ ├── agents │ ├── linear.clj │ ├── user.clj │ ├── startstop.clj │ ├── swarmer.clj │ ├── generic.clj │ ├── stone.clj │ ├── zigzag.clj │ ├── zapper.clj │ ├── beacon.clj │ ├── vent.clj │ └── nursery.clj │ ├── sensors.clj │ └── globals.clj ├── test └── pucks │ └── core_test.clj ├── target ├── base+system+user+dev+repl │ ├── classes │ │ └── META-INF │ │ │ └── maven │ │ │ └── pucks │ │ │ └── pucks │ │ │ └── pom.properties │ └── stale │ │ └── extract-native.dependencies ├── repl │ └── stale │ │ └── extract-native.dependencies ├── stale │ └── extract-native.dependencies └── base+system+user+dev │ └── stale │ └── extract-native.dependencies ├── .lein-repl-history ├── .project ├── .classpath └── project.clj /figwheel_server.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lspector/pucks/HEAD/.DS_Store -------------------------------------------------------------------------------- /src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lspector/pucks/HEAD/src/.DS_Store -------------------------------------------------------------------------------- /resources/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lspector/pucks/HEAD/resources/.DS_Store -------------------------------------------------------------------------------- /src/pucks/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lspector/pucks/HEAD/src/pucks/.DS_Store -------------------------------------------------------------------------------- /resources/public/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lspector/pucks/HEAD/resources/public/.DS_Store -------------------------------------------------------------------------------- /src/pucks/agents/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lspector/pucks/HEAD/src/pucks/agents/.DS_Store -------------------------------------------------------------------------------- /src/pucks/worlds/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lspector/pucks/HEAD/src/pucks/worlds/.DS_Store -------------------------------------------------------------------------------- /src/pucks/worlds/dev/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lspector/pucks/HEAD/src/pucks/worlds/dev/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | bin/ 3 | *.iml 4 | *.jar 5 | *.class 6 | /.lein-* 7 | /.nrepl-port 8 | .idea/ 9 | *.dependencies 10 | *~ 11 | -------------------------------------------------------------------------------- /doc/intro.md: -------------------------------------------------------------------------------- 1 | # Pucks documentation 2 | 3 | All of the pucks documentation is currently in the [ReadMe file] (https://github.com/lspector/pucks/blob/master/README.md). 4 | -------------------------------------------------------------------------------- /bin/pucks/core_test.clj: -------------------------------------------------------------------------------- 1 | (ns pucks.core-test 2 | (:require [clojure.test :refer :all] 3 | [pucks.core :refer :all])) 4 | 5 | (deftest a-test 6 | (testing "FIXME, I fail." 7 | (is (= 0 1)))) 8 | -------------------------------------------------------------------------------- /test/pucks/core_test.clj: -------------------------------------------------------------------------------- 1 | (ns pucks.core-test 2 | (:require [clojure.test :refer :all] 3 | [pucks.core :refer :all])) 4 | 5 | (deftest a-test 6 | (testing "FIXME, I fail." 7 | (is (= 0 1)))) 8 | -------------------------------------------------------------------------------- /target/base+system+user+dev+repl/classes/META-INF/maven/pucks/pucks/pom.properties: -------------------------------------------------------------------------------- 1 | #Leiningen 2 | #Tue Nov 03 22:48:49 EST 2015 3 | version=0.1.25 4 | revision=3827505bda5961f4c6d4dd5c261d429ac79d5d09 5 | groupId=pucks 6 | artifactId=pucks 7 | -------------------------------------------------------------------------------- /resources/public/js/development/cljsc_opts.edn: -------------------------------------------------------------------------------- 1 | {:output-wrapper false, :externs ["closure-js/externs"], :libs ["closure-js/libs"], :main "pucks.core", :output-to "resources/public/js/main.js", :output-dir "resources/public/js/development", :asset-path "js/development"} -------------------------------------------------------------------------------- /target/repl/stale/extract-native.dependencies: -------------------------------------------------------------------------------- 1 | ([:dependencies ([ccw/ccw.server "0.1.1"] [org.clojure/clojure "1.6.0"] [quil/quil "2.2.2"] [org.clojure/tools.nrepl "0.2.3" :exclusions [org.clojure/clojure]] [clojure-complete "0.2.3" :exclusions [org.clojure/clojure]])]) -------------------------------------------------------------------------------- /resources/public/js/development/process/env.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/jfong\/projects\/pucks\/resources\/public\/js\/development\/process\/env.js","sources":["env.cljs"],"lineCount":8,"mappings":";AAQA;;AAGA,AAAA,AAAA;AAAA;AAAA,AAAAA,YAAA,uBAAA","names":["goog\/define"]} -------------------------------------------------------------------------------- /resources/public/js/development/process/env.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 1.10.520 {} 2 | goog.provide('process.env'); 3 | goog.require('cljs.core'); 4 | 5 | /** @define {string} */ 6 | goog.define("process.env.NODE_ENV","development"); 7 | 8 | //# sourceMappingURL=env.js.map 9 | -------------------------------------------------------------------------------- /resources/public/js/optimized/cljsc_opts.edn: -------------------------------------------------------------------------------- 1 | {:output-wrapper true, :externs ["closure-js/externs"], :libs ["closure-js/libs"], :main "pucks.core", :output-to "resources/public/js/main.js", :output-dir "resources/public/js/optimized", :asset-path "js/optimized", :optimizations :advanced} -------------------------------------------------------------------------------- /target/stale/extract-native.dependencies: -------------------------------------------------------------------------------- 1 | ([:dependencies ([org.clojure/clojure "1.7.0"] [quil/quil "2.4.0"] [clojush/clojush "2.8.0"] [org.clojure/tools.nrepl "0.2.3" :exclusions ([org.clojure/clojure])] [clojure-complete/clojure-complete "0.2.3" :exclusions ([org.clojure/clojure])])]) -------------------------------------------------------------------------------- /.lein-repl-history: -------------------------------------------------------------------------------- 1 | (quit) 2 | (clojure.set/difference [1 2 3] [1 2]) 3 | (clojure.set/difference (set [1 2 3]) (set [1 2])) 4 | (vent) 5 | (use 'agents.vent) 6 | (use 'pucks.agents.vent) 7 | (vent) 8 | (keys (vent)) 9 | (use 'pucks.agents.active) 10 | (keys (active)) 11 | (quit) 12 | -------------------------------------------------------------------------------- /resources/public/js/optimized/process/env.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 1.10.520 {:static-fns true, :optimize-constants true} 2 | goog.provide('process.env'); 3 | goog.require('cljs.core'); 4 | goog.require('cljs.core.constants'); 5 | 6 | /** @define {string} */ 7 | goog.define("process.env.NODE_ENV","development"); 8 | -------------------------------------------------------------------------------- /target/base+system+user+dev+repl/stale/extract-native.dependencies: -------------------------------------------------------------------------------- 1 | ([:dependencies ([ccw/ccw.server "0.1.1"] [org.clojure/clojure "1.7.0"] [quil/quil "2.2.2"] [clojush/clojush "2.0.40"] [org.clojure/tools.nrepl "0.2.6" :exclusions [org.clojure/clojure] :scope "test"] [clojure-complete "0.2.3" :exclusions [org.clojure/clojure] :scope "test"])]) -------------------------------------------------------------------------------- /target/base+system+user+dev/stale/extract-native.dependencies: -------------------------------------------------------------------------------- 1 | ([:dependencies ([cider/cider-nrepl "0.9.1"] [org.clojure/clojure "1.7.0"] [quil/quil "2.4.0"] [clojush/clojush "2.8.0"] [org.clojure/tools.nrepl "0.2.6" :exclusions ([org.clojure/clojure]) :scope "test"] [clojure-complete/clojure-complete "0.2.3" :exclusions ([org.clojure/clojure]) :scope "test"])]) -------------------------------------------------------------------------------- /resources/public/style.css: -------------------------------------------------------------------------------- 1 | p { 2 | color: #bb7fbb; 3 | font-size: 18px; 4 | font-family: Raleway, sans-serif; 5 | text-align: center; 6 | text-shadow: 4px 4px 4px #d696d6d6; 7 | } 8 | select{ 9 | text-align-last:center; 10 | padding-right: 29px; 11 | direction: rtl; 12 | } 13 | body { 14 | background-color: #ffe6e6; 15 | } 16 | #pucks { 17 | text-align:center; 18 | } 19 | -------------------------------------------------------------------------------- /bin/pucks/worlds/dev/world3.clj: -------------------------------------------------------------------------------- 1 | ;; A pucks world. 2 | 3 | (ns pucks.worlds.dev.world3 4 | (:use [pucks globals] 5 | [pucks.agents zigzag startstop])) 6 | 7 | (defn agents [] 8 | [(merge (zigzag) 9 | {:position [400 400] 10 | :velocity [2 0]}) 11 | (merge (startstop) 12 | {:position [600 400] 13 | :velocity [2 0]})]) 14 | 15 | (defn settings [] 16 | {}) 17 | 18 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /bin/pucks/agents/linear.clj: -------------------------------------------------------------------------------- 1 | ;; Definitions for linear agents. 2 | 3 | (ns pucks.agents.linear 4 | (:use [pucks globals util] 5 | [pucks.agents active])) 6 | 7 | (defn linear-proposals [p] 8 | {:acceleration 0 9 | :rotation (relative-position->rotation (:velocity p))}) 10 | 11 | (defn linear [] 12 | (merge (active) 13 | {:linear true 14 | :proposal-function linear-proposals 15 | :color [0 0 255]})) 16 | 17 | -------------------------------------------------------------------------------- /bin/pucks/worlds/dev/world2.clj: -------------------------------------------------------------------------------- 1 | ;; A pucks world. 2 | 3 | (ns pucks.worlds.dev.world2 4 | (:use [pucks core globals] 5 | [pucks.agents linear vent])) 6 | 7 | (defn agents [] 8 | [(merge (linear) 9 | {:position [100 300] 10 | :rotation (/ pi 2) 11 | :velocity [2 0]}) 12 | (merge (vent) 13 | {:position [500 300]})]) 14 | 15 | (defn settings [] 16 | {}) 17 | 18 | ;(run-pucks (agents) (settings)) 19 | -------------------------------------------------------------------------------- /bin/pucks/agents/user.clj: -------------------------------------------------------------------------------- 1 | ;; Definition for user agents. This is a good template to build on to produce 2 | ;; smarter agents. 3 | 4 | (ns pucks.agents.user 5 | (:use [pucks globals util] 6 | [pucks.agents active])) 7 | 8 | (defn user-proposals [p] 9 | {:acceleration 0 10 | :rotation (relative-position->rotation (:velocity p))}) 11 | 12 | (defn user [] 13 | (merge (active) 14 | {:user true 15 | :proposal-function user-proposals})) 16 | -------------------------------------------------------------------------------- /resources/public/js/development/propeller/push/core.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/jfong\/projects\/pucks\/resources\/public\/js\/development\/propeller\/push\/core.js","sources":["core.cljc"],"lineCount":7,"mappings":";AAAA;;AAIA,AAAKA,wCAAkB,AAACC,yBAAK,AAAAC;AAG7B,4BAAA,2CAAA,2DAAA,IAAA,4DAAA,IAAA,+DAAA,IAAA,gEAAA,IAAA,wEAAA,IAAA,0DAAA,IAAA,yDAAA,IAAA,yDAAA,7kBAAKC","names":["propeller.push.core\/instruction-table","cljs.core\/atom","cljs.core\/PersistentHashMap","propeller.push.core\/opens"]} -------------------------------------------------------------------------------- /src/pucks/agents/linear.cljc: -------------------------------------------------------------------------------- 1 | ;; Definitions for linear agents. 2 | 3 | (ns pucks.agents.linear 4 | (:require [pucks.util :as util] 5 | [pucks.agents.active :as active])) 6 | 7 | (defn linear-proposals [p] 8 | {:acceleration 0 9 | :rotation (util/relative-position->rotation (:velocity p))}) 10 | 11 | (defn linear [] 12 | (merge (active/active) 13 | {:linear true 14 | :proposal-function linear-proposals 15 | :color [0 0 255]})) 16 | 17 | -------------------------------------------------------------------------------- /src/pucks/agents/user.cljc: -------------------------------------------------------------------------------- 1 | ;; Definition for user agents. This is a good template to build on to produce 2 | ;; smarter agents. 3 | 4 | (ns pucks.agents.user 5 | (:require [pucks.util :as util] 6 | [pucks.agents.active :as active])) 7 | 8 | (defn user-proposals [p] 9 | {:acceleration 0 10 | :rotation (util/relative-position->rotation (:velocity p))}) 11 | 12 | (defn user [] 13 | (merge (active/active) 14 | {:user true 15 | :proposal-function user-proposals})) 16 | -------------------------------------------------------------------------------- /src/pucks/worlds/dev/world3.cljc: -------------------------------------------------------------------------------- 1 | ;; A pucks world. 2 | 3 | (ns pucks.worlds.dev.world3 4 | (:require [pucks.agents.zigzag :as zigzag] 5 | [pucks.agents.startstop :as startstop]) 6 | ) 7 | 8 | (defn agents [] 9 | [(merge (zigzag/zigzag) 10 | {:position [400 400] 11 | :velocity [2 0]}) 12 | (merge (startstop/startstop) 13 | {:position [600 400] 14 | :velocity [2 0]})]) 15 | 16 | (defn settings [] 17 | {}) 18 | 19 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/linear.cljc: -------------------------------------------------------------------------------- 1 | ;; Definitions for linear agents. 2 | 3 | (ns pucks.agents.linear 4 | (:require [pucks.util :as util] 5 | [pucks.agents.active :as active])) 6 | 7 | (defn linear-proposals [p] 8 | {:acceleration 0 9 | :rotation (util/relative-position->rotation (:velocity p))}) 10 | 11 | (defn linear [] 12 | (merge (active/active) 13 | {:linear true 14 | :proposal-function linear-proposals 15 | :color [0 0 255]})) 16 | 17 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/user.cljc: -------------------------------------------------------------------------------- 1 | ;; Definition for user agents. This is a good template to build on to produce 2 | ;; smarter agents. 3 | 4 | (ns pucks.agents.user 5 | (:require [pucks.util :as util] 6 | [pucks.agents.active :as active])) 7 | 8 | (defn user-proposals [p] 9 | {:acceleration 0 10 | :rotation (util/relative-position->rotation (:velocity p))}) 11 | 12 | (defn user [] 13 | (merge (active/active) 14 | {:user true 15 | :proposal-function user-proposals})) 16 | -------------------------------------------------------------------------------- /resources/public/js/development/propeller/push/utils/globals.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 1.10.520 {} 2 | goog.provide('propeller.push.utils.globals'); 3 | goog.require('cljs.core'); 4 | propeller.push.utils.globals.max_stack_items = (100); 5 | propeller.push.utils.globals.max_number_magnitude = 1000000.0; 6 | propeller.push.utils.globals.min_number_magnitude = 1.0E-6; 7 | propeller.push.utils.globals.max_string_length = (1000); 8 | propeller.push.utils.globals.max_vector_length = (1000); 9 | 10 | //# sourceMappingURL=globals.js.map 11 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world3.cljc: -------------------------------------------------------------------------------- 1 | ;; A pucks world. 2 | 3 | (ns pucks.worlds.dev.world3 4 | (:require [pucks.agents.zigzag :as zigzag] 5 | [pucks.agents.startstop :as startstop]) 6 | ) 7 | 8 | (defn agents [] 9 | [(merge (zigzag/zigzag) 10 | {:position [400 400] 11 | :velocity [2 0]}) 12 | (merge (startstop/startstop) 13 | {:position [600 400] 14 | :velocity [2 0]})]) 15 | 16 | (defn settings [] 17 | {}) 18 | 19 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /bin/pucks/worlds/ai/world1.clj: -------------------------------------------------------------------------------- 1 | ;; A pucks world. 2 | 3 | (ns pucks.worlds.ai.world1 4 | (:use [pucks core globals] 5 | [pucks.agents stone vent zapper user])) 6 | 7 | (defn agents [] 8 | (concat (for [y (take 20 (iterate #(+ % 20) 100))] 9 | (merge (stone) {:position [400 y]})) 10 | [(merge (vent) {:position [600 300]}) 11 | (merge (zapper) {:position [300 300]}) 12 | (merge (user) {:position [200 300]})])) 13 | 14 | (defn settings [] 15 | {}) 16 | 17 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/user.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/jfong\/projects\/pucks\/resources\/public\/js\/development\/pucks\/agents\/user.js","sources":["user.cljc"],"lineCount":13,"mappings":";AAGA;;;;AAIA,mCAAA,nCAAMA,8EAAgBC;AAAtB,AAAA,kDAAA,sEAAA,IAAA,8DAEa,AAACC,oDAAiC,AAAA,2FAAWD;;AAE1D,yBAAA,zBAAME;AAAN,AACE,uEAAA,2CAAA,qDAAA,KAAA,rKAACC,0BAAM,AAACC,0NAEmBL","names":["pucks.agents.user\/user-proposals","p","pucks.util\/relative-position->rotation","pucks.agents.user\/user","cljs.core\/merge","pucks.agents.active\/active"]} -------------------------------------------------------------------------------- /src/pucks/agents/shooter.cljc: -------------------------------------------------------------------------------- 1 | 2 | ;; Definitions for shooter agents. 3 | 4 | (ns pucks.agents.shooter 5 | (:require [pucks.util :as util] 6 | [pucks.agents.active :as active])) 7 | 8 | 9 | (defn shooter-proposals [p] 10 | {:acceleration 0 11 | :rotation (util/relative-position->rotation (:velocity p)) 12 | :fire-torpedo (zero? (rand-int 20))}) 13 | 14 | (defn shooter [] 15 | (merge (active/active) 16 | {:linear true 17 | :proposal-function shooter-proposals 18 | :color [255 0 0]})) 19 | -------------------------------------------------------------------------------- /src/pucks/worlds/dev/world2.cljc: -------------------------------------------------------------------------------- 1 | ;; A pucks world. 2 | 3 | (ns pucks.worlds.dev.world2 4 | (:require [pucks.globals :as globals] 5 | [pucks.agents.vent :as vent] 6 | [pucks.agents.linear :as linear])) 7 | 8 | (defn agents [] 9 | [(merge (linear/linear) 10 | {:position [100 300] 11 | :rotation (/ globals/pi 2) 12 | :velocity [2 0]}) 13 | (merge (vent/vent) 14 | {:position [500 300]})]) 15 | 16 | (defn settings [] 17 | {}) 18 | 19 | ;(run-pucks (agents) (settings)) 20 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/shooter.cljc: -------------------------------------------------------------------------------- 1 | 2 | ;; Definitions for shooter agents. 3 | 4 | (ns pucks.agents.shooter 5 | (:require [pucks.util :as util] 6 | [pucks.agents.active :as active])) 7 | 8 | 9 | (defn shooter-proposals [p] 10 | {:acceleration 0 11 | :rotation (util/relative-position->rotation (:velocity p)) 12 | :fire-torpedo (zero? (rand-int 20))}) 13 | 14 | (defn shooter [] 15 | (merge (active/active) 16 | {:linear true 17 | :proposal-function shooter-proposals 18 | :color [255 0 0]})) 19 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world2.cljc: -------------------------------------------------------------------------------- 1 | ;; A pucks world. 2 | 3 | (ns pucks.worlds.dev.world2 4 | (:require [pucks.globals :as globals] 5 | [pucks.agents.vent :as vent] 6 | [pucks.agents.linear :as linear])) 7 | 8 | (defn agents [] 9 | [(merge (linear/linear) 10 | {:position [100 300] 11 | :rotation (/ globals/pi 2) 12 | :velocity [2 0]}) 13 | (merge (vent/vent) 14 | {:position [500 300]})]) 15 | 16 | (defn settings [] 17 | {}) 18 | 19 | ;(run-pucks (agents) (settings)) 20 | -------------------------------------------------------------------------------- /resources/public/js/optimized/propeller/push/utils/globals.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 1.10.520 {:static-fns true, :optimize-constants true} 2 | goog.provide('propeller.push.utils.globals'); 3 | goog.require('cljs.core'); 4 | goog.require('cljs.core.constants'); 5 | propeller.push.utils.globals.max_stack_items = (100); 6 | propeller.push.utils.globals.max_number_magnitude = 1000000.0; 7 | propeller.push.utils.globals.min_number_magnitude = 1.0E-6; 8 | propeller.push.utils.globals.max_string_length = (1000); 9 | propeller.push.utils.globals.max_vector_length = (1000); 10 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/linear.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/jfong\/projects\/pucks\/resources\/public\/js\/development\/pucks\/agents\/linear.js","sources":["linear.cljc"],"lineCount":13,"mappings":";AAEA;;;;AAIA,uCAAA,vCAAMA,sFAAkBC;AAAxB,AAAA,kDAAA,sEAAA,IAAA,8DAEa,AAACC,oDAAiC,AAAA,2FAAWD;;AAE1D,6BAAA,7BAAME;AAAN,AACE,uEAAA,2CAAA,wDAAA,KAAA,oHAAA,uDAAA,mFAAA,IAAA,IAAA,9aAACC,0BAAM,AAACC,6NAEmBL","names":["pucks.agents.linear\/linear-proposals","p","pucks.util\/relative-position->rotation","pucks.agents.linear\/linear","cljs.core\/merge","pucks.agents.active\/active"]} -------------------------------------------------------------------------------- /resources/public/js/development/propeller/push/utils/globals.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/jfong\/projects\/pucks\/resources\/public\/js\/development\/propeller\/push\/utils\/globals.js","sources":["globals.cljc"],"lineCount":10,"mappings":";AAAA;;AAUA,+CAAA,\/CAAKA;AAUL,oDAAA,pDAAKC;AAGL,oDAAA,pDAAKC;AAGL,iDAAA,jDAAKC;AAGL,iDAAA,jDAAKC","names":["propeller.push.utils.globals\/max-stack-items","propeller.push.utils.globals\/max-number-magnitude","propeller.push.utils.globals\/min-number-magnitude","propeller.push.utils.globals\/max-string-length","propeller.push.utils.globals\/max-vector-length"]} -------------------------------------------------------------------------------- /resources/public/js/development/propeller/push/core.cljc: -------------------------------------------------------------------------------- 1 | (ns propeller.push.core) 2 | 3 | ;; PushGP instructions are represented as keywords, and stored in an atom. They 4 | ;; can be either constant literals or functions that take and return a Push state 5 | (def instruction-table (atom (hash-map))) 6 | 7 | ;; Number of blocks opened by instructions (default = 0) 8 | (def opens {:exec_dup 1 9 | :exec_if 2 10 | :exec_when 1 11 | :exec_while 1 12 | :exec_do_while 1 13 | :exec_k 2 14 | :exec_s 3 15 | :exec_y 1}) 16 | -------------------------------------------------------------------------------- /resources/public/js/optimized/propeller/push/core.cljc: -------------------------------------------------------------------------------- 1 | (ns propeller.push.core) 2 | 3 | ;; PushGP instructions are represented as keywords, and stored in an atom. They 4 | ;; can be either constant literals or functions that take and return a Push state 5 | (def instruction-table (atom (hash-map))) 6 | 7 | ;; Number of blocks opened by instructions (default = 0) 8 | (def opens {:exec_dup 1 9 | :exec_if 2 10 | :exec_when 1 11 | :exec_while 1 12 | :exec_do_while 1 13 | :exec_k 2 14 | :exec_s 3 15 | :exec_y 1}) 16 | -------------------------------------------------------------------------------- /src/pucks/worlds/dev/world11.cljc: -------------------------------------------------------------------------------- 1 | (ns pucks.worlds.dev.world11 2 | (:require [pucks.globals :as globals] 3 | [pucks.agents.donor :as donor] 4 | [pucks.agents.linear :as linear])) 5 | 6 | (defn agents [] 7 | [(merge (linear/linear) {:position [100 400] 8 | :rotation globals/half-pi 9 | :velocity [2 0]}) 10 | (merge (donor/donor :key) {:position [400 700] 11 | :rotation 0 12 | :velocity [0 -2]})]) 13 | 14 | (defn settings [] 15 | {}) 16 | 17 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /bin/pucks/agents/startstop.clj: -------------------------------------------------------------------------------- 1 | ;; Definitions for startstop agents. 2 | 3 | (ns pucks.agents.startstop 4 | (:use [pucks globals util vec2D] 5 | pucks.agents.active)) 6 | 7 | ;; if you don't scale the reverse acceleration you can get oscillations 8 | 9 | (defn startstop-proposals [p] 10 | {:acceleration (if (< (mod (:steps p) 50) 25) 11 | 1 12 | (* 0.25 (- (length (:velocity p)))))}) 13 | 14 | (defn startstop [] 15 | (merge (active) 16 | {:startstop true 17 | :proposal-function startstop-proposals 18 | :color [96 255 96]})) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world3.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/jfong\/projects\/pucks\/resources\/public\/js\/development\/pucks\/worlds\/dev\/world3.js","sources":["world3.cljc"],"lineCount":13,"mappings":";AAEA;;;;AAKA,iCAAA,jCAAMA;AAAN,AAAA,0FACG,gEAAA,2CAAA,8DAAA,mFAAA,MAAA,cAAA,6DAAA,mFAAA,IAAA,paAACC,0BAAM,AAACC,+ZAGR,sEAAA,2CAAA,8DAAA,mFAAA,MAAA,cAAA,6DAAA,mFAAA,IAAA,1aAACD,0BAAM,AAACE;;AAIX,mCAAA,nCAAMC;AAAN,AAAA","names":["pucks.worlds.dev.world3\/agents","cljs.core\/merge","pucks.agents.zigzag\/zigzag","pucks.agents.startstop\/startstop","pucks.worlds.dev.world3\/settings"]} -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world2.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/jfong\/projects\/pucks\/resources\/public\/js\/development\/pucks\/worlds\/dev\/world2.js","sources":["world2.cljc"],"lineCount":14,"mappings":";AAEA;;;;;AAKA,iCAAA,jCAAMA;AAAN,AAAA,0FACG,gEAAA,2CAAA,8DAAA,mFAAA,MAAA,cAAA,uFAAA,6DAAA,mFAAA,IAAA,3fAACC,0BAAM,AAACC,oTAEU,oBAAA,nBAAGC,iMAErB,4DAAA,2CAAA,8DAAA,mFAAA,MAAA,9PAACF,0BAAM,AAACG;;AAGX,mCAAA,nCAAMC;AAAN,AAAA","names":["pucks.worlds.dev.world2\/agents","cljs.core\/merge","pucks.agents.linear\/linear","pucks.globals\/pi","pucks.agents.vent\/vent","pucks.worlds.dev.world2\/settings"]} -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world11.cljc: -------------------------------------------------------------------------------- 1 | (ns pucks.worlds.dev.world11 2 | (:require [pucks.globals :as globals] 3 | [pucks.agents.donor :as donor] 4 | [pucks.agents.linear :as linear])) 5 | 6 | (defn agents [] 7 | [(merge (linear/linear) {:position [100 400] 8 | :rotation globals/half-pi 9 | :velocity [2 0]}) 10 | (merge (donor/donor :key) {:position [400 700] 11 | :rotation 0 12 | :velocity [0 -2]})]) 13 | 14 | (defn settings [] 15 | {}) 16 | 17 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /src/pucks/agents/startstop.cljc: -------------------------------------------------------------------------------- 1 | ;; Definitions for startstop agents. 2 | 3 | (ns pucks.agents.startstop 4 | (:require [pucks.vec2D :as vec2D] 5 | [pucks.agents.active :as active])) 6 | 7 | ;; if you don't scale the reverse acceleration you can get oscillations 8 | 9 | (defn startstop-proposals [p] 10 | {:acceleration (if (< (mod (:steps p) 50) 25) 11 | 1 12 | (* 0.25 (- (vec2D/length (:velocity p)))))}) 13 | 14 | (defn startstop [] 15 | (merge (active/active) 16 | {:startstop true 17 | :proposal-function startstop-proposals 18 | :color [96 255 96]})) -------------------------------------------------------------------------------- /resources/public/js/main.js: -------------------------------------------------------------------------------- 1 | var CLOSURE_UNCOMPILED_DEFINES = {}; 2 | var CLOSURE_NO_DEPS = true; 3 | if(typeof goog == "undefined") document.write(''); 4 | document.write(''); 5 | document.write(''); 6 | document.write(''); 7 | document.write(''); 8 | document.write(''); 9 | -------------------------------------------------------------------------------- /bin/pucks/worlds/dev/world5.clj: -------------------------------------------------------------------------------- 1 | ;; A pucks world. 2 | 3 | (ns pucks.worlds.dev.world5 4 | (:use [pucks globals] 5 | [pucks.agents zigzag startstop])) 6 | 7 | (defn agents [] 8 | [(merge (zigzag) ;; zigzag has memory 9 | {:position [200 200] 10 | :velocity [2 0]}) 11 | (merge (zigzag) ;; zigzag has memory 12 | {:position [200 400] 13 | :velocity [2 0] 14 | :inventory [:cheese]}) 15 | (merge (startstop) 16 | {:position [600 400] 17 | :velocity [2 0] 18 | :inventory [:cheese]})]) 19 | 20 | (defn settings [] 21 | {}) 22 | 23 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/shooter.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/jfong\/projects\/pucks\/resources\/public\/js\/development\/pucks\/agents\/shooter.js","sources":["shooter.cljc"],"lineCount":13,"mappings":";AAGA;;;;AAKA,yCAAA,zCAAMA,0FAAmBC;AAAzB,AAAA,kDAAA,sEAAA,IAAA,iNAAA,nJAEa,AAACC,oDAAiC,AAAA,2FAAWD,yEACzC,wCAAA,vCAAO,6BAAA,7BAACE;;AAEzB,+BAAA,\/BAAMC;AAAN,AACE,uEAAA,2CAAA,wDAAA,KAAA,sHAAA,uDAAA,mFAAA,MAAA,IAAA,lbAACC,0BAAM,AAACC,6NAEmBN","names":["pucks.agents.shooter\/shooter-proposals","p","pucks.util\/relative-position->rotation","cljs.core\/rand-int","pucks.agents.shooter\/shooter","cljs.core\/merge","pucks.agents.active\/active"]} -------------------------------------------------------------------------------- /resources/public/js/optimized/process/env.cljs: -------------------------------------------------------------------------------- 1 | ;; Copyright (c) Rich Hickey. All rights reserved. 2 | ;; The use and distribution terms for this software are covered by the 3 | ;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) 4 | ;; which can be found in the file epl-v10.html at the root of this distribution. 5 | ;; By using this software in any fashion, you are agreeing to be bound by 6 | ;; the terms of this license. 7 | ;; You must not remove this notice, or any other, from this software. 8 | 9 | (ns process.env 10 | "A shim namespace for the Node.js process library") 11 | 12 | (goog-define NODE_ENV "development") 13 | -------------------------------------------------------------------------------- /src/pucks/worlds/dev/world14.cljc: -------------------------------------------------------------------------------- 1 | (ns pucks.worlds.dev.world14 2 | (:require [pucks.agents.spawner :as spawner] 3 | [pucks.agents.nursery :as nursery] 4 | [pucks.agents.vent :as vent])) 5 | 6 | (defn agents [] 7 | (vec (concat 8 | (for [x (range 100 1901 200) 9 | y (range 100 1901 200)] 10 | (assoc (vent/vent) :position [x y])) 11 | [(assoc (nursery/nursery spawner/spawner) :position [1000 1000])]))) 12 | 13 | (defn settings [] 14 | {:screen-size 2000 15 | :scale 0.4 16 | :single-thread-mode false 17 | :nursery-threshold 10}) 18 | 19 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /src/pucks/worlds/dev/world18.cljc: -------------------------------------------------------------------------------- 1 | ;; for speed testing, by Eddie Pantridge (modified by Lee Spector) 2 | ;; will terminate and print iterations completed 3 | 4 | (ns pucks.worlds.dev.world18 5 | (:require [pucks.agents.swarmer :as swarmer] 6 | [pucks.agents.nursery :as nursery])) 7 | 8 | (defn agents [] 9 | (concat 10 | (for [x (range 100 1800 200) 11 | y (range 100 1800 200)] 12 | (merge (nursery/nursery swarmer/swarmer) {:position [x y]})))) 13 | 14 | (defn settings [] 15 | {:screen-size 1800 16 | :scale 0.5 17 | :neighborhood-size 100 18 | :ms-limit 60000}) 19 | 20 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /resources/public/js/development/process/env.cljs: -------------------------------------------------------------------------------- 1 | ;; Copyright (c) Rich Hickey. All rights reserved. 2 | ;; The use and distribution terms for this software are covered by the 3 | ;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) 4 | ;; which can be found in the file epl-v10.html at the root of this distribution. 5 | ;; By using this software in any fashion, you are agreeing to be bound by 6 | ;; the terms of this license. 7 | ;; You must not remove this notice, or any other, from this software. 8 | 9 | (ns process.env 10 | "A shim namespace for the Node.js process library") 11 | 12 | (goog-define NODE_ENV "development") 13 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world11.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/jfong\/projects\/pucks\/resources\/public\/js\/development\/pucks\/worlds\/dev\/world11.js","sources":["world11.cljc"],"lineCount":14,"mappings":";AAAA;;;;;AAKA,kCAAA,lCAAMA;AAAN,AAAA,0FACG,gEAAA,2CAAA,8DAAA,mFAAA,MAAA,cAAA,oFAAA,6DAAA,mFAAA,IAAA,xfAACC,0BAAM,AAACC,oTACmBC,+LAE3B,kHAAA,2CAAA,8DAAA,mFAAA,MAAA,cAAA,8DAAA,IAAA,6DAAA,mFAAA,IAAA,xhBAACF,0BAAM,mCAAA,nCAACG;;AAIX,oCAAA,pCAAMC;AAAN,AAAA","names":["pucks.worlds.dev.world11\/agents","cljs.core\/merge","pucks.agents.linear\/linear","pucks.globals\/half-pi","pucks.agents.donor\/donor","pucks.worlds.dev.world11\/settings"]} -------------------------------------------------------------------------------- /bin/pucks/worlds/dev/world4.clj: -------------------------------------------------------------------------------- 1 | ;; A pucks world. 2 | 3 | (ns pucks.worlds.dev.world4 4 | (:use [pucks core globals] 5 | [pucks.agents linear stone])) 6 | 7 | (defn agents [] 8 | (concat (for [y (take 15 (iterate #(+ % 20) 100))] 9 | (merge (stone) {:position [400 y]})) 10 | (for [x (take 16 (iterate #(+ % 20) 50))] 11 | (merge (stone) {:position [x 100]})) 12 | [(merge (linear) 13 | {:position [100 300] 14 | :rotation (/ pi 2) 15 | :velocity [2 0]})])) 16 | 17 | (defn settings [] 18 | {:screen-size 500}) 19 | 20 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/startstop.cljc: -------------------------------------------------------------------------------- 1 | ;; Definitions for startstop agents. 2 | 3 | (ns pucks.agents.startstop 4 | (:require [pucks.vec2D :as vec2D] 5 | [pucks.agents.active :as active])) 6 | 7 | ;; if you don't scale the reverse acceleration you can get oscillations 8 | 9 | (defn startstop-proposals [p] 10 | {:acceleration (if (< (mod (:steps p) 50) 25) 11 | 1 12 | (* 0.25 (- (vec2D/length (:velocity p)))))}) 13 | 14 | (defn startstop [] 15 | (merge (active/active) 16 | {:startstop true 17 | :proposal-function startstop-proposals 18 | :color [96 255 96]})) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/startstop.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/jfong\/projects\/pucks\/resources\/public\/js\/development\/pucks\/agents\/startstop.js","sources":["startstop.cljc"],"lineCount":13,"mappings":";AAEA;;;;AAMA,6CAAA,7CAAMA,kGAAqBC;AAA3B,AAAA,kDAAA,sEACiB,kIAAA,hIAAI,yHAAA,xHAAG,gHAAA,hHAACC,wBAAI,AAAA,qFAAQD,sBAEnB,CAAA,OAAQ,GAAG,AAACE,6BAAa,AAAA,2FAAWF;;AAEtD,mCAAA,nCAAMG;AAAN,AACE,uEAAA,2CAAA,+DAAA,KAAA,0HAAA,uDAAA,mFAAA,KAAA,MAAA,9bAACC,0BAAM,AAACC,oOAEmBN","names":["pucks.agents.startstop\/startstop-proposals","p","cljs.core\/mod","pucks.vec2D\/length","pucks.agents.startstop\/startstop","cljs.core\/merge","pucks.agents.active\/active"]} -------------------------------------------------------------------------------- /src/pucks/worlds/ai/world1.cljc: -------------------------------------------------------------------------------- 1 | ;; A pucks world. 2 | 3 | (ns pucks.worlds.ai.world1 4 | (:require [pucks.agents.stone :as stone] 5 | [pucks.agents.user :as user] 6 | [pucks.agents.vent :as vent] 7 | [pucks.agents.zapper :as zapper])) 8 | 9 | (defn agents [] 10 | (concat (for [y (take 20 (iterate #(+ % 20) 100))] 11 | (merge (stone/stone) {:position [400 y]})) 12 | [(merge (vent/vent) {:position [600 300]}) 13 | (merge (zapper/zapper) {:position [300 300]}) 14 | (merge (user/user) {:position [200 300]})])) 15 | 16 | (defn settings [] 17 | {}) 18 | 19 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world14.cljc: -------------------------------------------------------------------------------- 1 | (ns pucks.worlds.dev.world14 2 | (:require [pucks.agents.spawner :as spawner] 3 | [pucks.agents.nursery :as nursery] 4 | [pucks.agents.vent :as vent])) 5 | 6 | (defn agents [] 7 | (vec (concat 8 | (for [x (range 100 1901 200) 9 | y (range 100 1901 200)] 10 | (assoc (vent/vent) :position [x y])) 11 | [(assoc (nursery/nursery spawner/spawner) :position [1000 1000])]))) 12 | 13 | (defn settings [] 14 | {:screen-size 2000 15 | :scale 0.4 16 | :single-thread-mode false 17 | :nursery-threshold 10}) 18 | 19 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world18.cljc: -------------------------------------------------------------------------------- 1 | ;; for speed testing, by Eddie Pantridge (modified by Lee Spector) 2 | ;; will terminate and print iterations completed 3 | 4 | (ns pucks.worlds.dev.world18 5 | (:require [pucks.agents.swarmer :as swarmer] 6 | [pucks.agents.nursery :as nursery])) 7 | 8 | (defn agents [] 9 | (concat 10 | (for [x (range 100 1800 200) 11 | y (range 100 1800 200)] 12 | (merge (nursery/nursery swarmer/swarmer) {:position [x y]})))) 13 | 14 | (defn settings [] 15 | {:screen-size 1800 16 | :scale 0.5 17 | :neighborhood-size 100 18 | :ms-limit 60000}) 19 | 20 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /resources/public/js/optimized/propeller/push/core.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 1.10.520 {:static-fns true, :optimize-constants true} 2 | goog.provide('propeller.push.core'); 3 | goog.require('cljs.core'); 4 | goog.require('cljs.core.constants'); 5 | propeller.push.core.instruction_table = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(cljs.core.PersistentHashMap.EMPTY); 6 | propeller.push.core.opens = new cljs.core.PersistentArrayMap(null, 8, [cljs.core.cst$kw$exec_dup,(1),cljs.core.cst$kw$exec_if,(2),cljs.core.cst$kw$exec_when,(1),cljs.core.cst$kw$exec_while,(1),cljs.core.cst$kw$exec_do_while,(1),cljs.core.cst$kw$exec_k,(2),cljs.core.cst$kw$exec_s,(3),cljs.core.cst$kw$exec_y,(1)], null); 7 | -------------------------------------------------------------------------------- /src/pucks/worlds/dev/world20.cljc: -------------------------------------------------------------------------------- 1 | (ns pucks.worlds.dev.world20 2 | (:require [pucks.agents.bondevolver :as bondevolver] 3 | [pucks.agents.nursery :as nursery] 4 | [pucks.agents.vent :as vent])) 5 | 6 | (defn agents [] 7 | (vec (concat 8 | (for [x (range 100 1200 200) 9 | y (range 100 1200 200)] 10 | (assoc (vent/vent) :position [x y])) 11 | [(assoc (nursery/nursery bondevolver/bondevolver) :position [600 600])]))) 12 | 13 | (defn settings [] 14 | {:screen-size 1200 15 | :scale 0.6 16 | :single-thread-mode false 17 | :nursery-threshold 5 18 | :max-velocity 40}) 19 | 20 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/ai/world1.cljc: -------------------------------------------------------------------------------- 1 | ;; A pucks world. 2 | 3 | (ns pucks.worlds.ai.world1 4 | (:require [pucks.agents.stone :as stone] 5 | [pucks.agents.user :as user] 6 | [pucks.agents.vent :as vent] 7 | [pucks.agents.zapper :as zapper])) 8 | 9 | (defn agents [] 10 | (concat (for [y (take 20 (iterate #(+ % 20) 100))] 11 | (merge (stone/stone) {:position [400 y]})) 12 | [(merge (vent/vent) {:position [600 300]}) 13 | (merge (zapper/zapper) {:position [300 300]}) 14 | (merge (user/user) {:position [200 300]})])) 15 | 16 | (defn settings [] 17 | {}) 18 | 19 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /src/pucks/worlds/dev/world5.cljc: -------------------------------------------------------------------------------- 1 | ;; A pucks world. 2 | 3 | (ns pucks.worlds.dev.world5 4 | (:require [pucks.agents.zigzag :as zigzag] 5 | [pucks.agents.startstop :as startstop])) 6 | 7 | (defn agents [] 8 | [(merge (zigzag/zigzag) ;; zigzag has memory 9 | {:position [200 200] 10 | :velocity [2 0]}) 11 | (merge (zigzag/zigzag) ;; zigzag has memory 12 | {:position [200 400] 13 | :velocity [2 0] 14 | :inventory [:cheese]}) 15 | (merge (startstop/startstop) 16 | {:position [600 400] 17 | :velocity [2 0] 18 | :inventory [:cheese]})]) 19 | 20 | (defn settings [] 21 | {}) 22 | 23 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /bin/pucks/worlds/dev/world1.clj: -------------------------------------------------------------------------------- 1 | ;; A pucks world. 2 | 3 | (ns pucks.worlds.dev.world1 4 | (:use [pucks core globals] 5 | [pucks.agents nursery linear stone vent zapper swarmer beacon shooter])) 6 | 7 | (defn agents [] 8 | (concat (repeatedly 10 stone) 9 | (repeatedly 10 vent) 10 | (repeatedly 5 zapper) 11 | [(nursery #(merge (linear) {:inventory [:something]}))] 12 | [(nursery #(merge (swarmer) {:memory {:something :rembered}}))] 13 | [(nursery #(if (zero? (rand-int 2)) (linear) (shooter)))] 14 | [(nursery swarmer)] 15 | (repeatedly 2 beacon))) 16 | 17 | 18 | (defn settings [] 19 | {}) 20 | 21 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world5.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/jfong\/projects\/pucks\/resources\/public\/js\/development\/pucks\/worlds\/dev\/world5.js","sources":["world5.cljc"],"lineCount":13,"mappings":";AAEA;;;;AAIA,iCAAA,jCAAMA;AAAN,AAAA,0FACG,gEAAA,2CAAA,8DAAA,mFAAA,MAAA,cAAA,6DAAA,mFAAA,IAAA,paAACC,0BAAM,AAACC,+ZAGR,gEAAA,2CAAA,8DAAA,mFAAA,MAAA,cAAA,6DAAA,mFAAA,IAAA,YAAA,8DAAA,mFAAA,jkBAACD,0BAAM,AAACC,inBAIR,sEAAA,2CAAA,8DAAA,mFAAA,MAAA,cAAA,6DAAA,mFAAA,IAAA,YAAA,8DAAA,mFAAA,vkBAACD,0BAAM,AAACE;;AAKX,mCAAA,nCAAMC;AAAN,AAAA","names":["pucks.worlds.dev.world5\/agents","cljs.core\/merge","pucks.agents.zigzag\/zigzag","pucks.agents.startstop\/startstop","pucks.worlds.dev.world5\/settings"]} -------------------------------------------------------------------------------- /src/pucks/agents/donor.cljc: -------------------------------------------------------------------------------- 1 | (ns pucks.agents.donor 2 | (:require [pucks.util :as util] 3 | [pucks.agents.active :as active])) 4 | 5 | (defn donor-proposals [p item] 6 | {:rotation (util/relative-position->rotation (:velocity p)) 7 | :transfer (into [] (for [recipient (filter :mobile (:overlaps p))] 8 | {:self (:id p) 9 | :other (:id recipient) 10 | :bid {:inventory item} 11 | :ask {}}))}) 12 | 13 | (defn donor [item] 14 | (merge (active/active) 15 | {:donor true 16 | :inventory [item] 17 | :proposal-function #(donor-proposals % item) 18 | :color [255 0 0]})) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world20.cljc: -------------------------------------------------------------------------------- 1 | (ns pucks.worlds.dev.world20 2 | (:require [pucks.agents.bondevolver :as bondevolver] 3 | [pucks.agents.nursery :as nursery] 4 | [pucks.agents.vent :as vent])) 5 | 6 | (defn agents [] 7 | (vec (concat 8 | (for [x (range 100 1200 200) 9 | y (range 100 1200 200)] 10 | (assoc (vent/vent) :position [x y])) 11 | [(assoc (nursery/nursery bondevolver/bondevolver) :position [600 600])]))) 12 | 13 | (defn settings [] 14 | {:screen-size 1200 15 | :scale 0.6 16 | :single-thread-mode false 17 | :nursery-threshold 5 18 | :max-velocity 40}) 19 | 20 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /resources/public/js/development/process/env.cljs.cache.json: -------------------------------------------------------------------------------- 1 | ["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$process.env","~:imports",null,"~:requires",null,"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$NODE_ENV",["^ ","~:meta",["^ ","~:file","/Users/jfong/projects/pucks/resources/public/js/development/process/env.cljs","~:line",12,"~:column",14,"~:end-line",12,"~:end-column",22,"~:tag","~$string","~:declared",true],"^5","~$process.env/NODE_ENV","^>","resources/public/js/development/process/env.cljs","^B",22,"^@",1,"^?",12,"^E",true,"^A",12,"^C","^D"]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:doc","A shim namespace for the Node.js process library"] -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world5.cljc: -------------------------------------------------------------------------------- 1 | ;; A pucks world. 2 | 3 | (ns pucks.worlds.dev.world5 4 | (:require [pucks.agents.zigzag :as zigzag] 5 | [pucks.agents.startstop :as startstop])) 6 | 7 | (defn agents [] 8 | [(merge (zigzag/zigzag) ;; zigzag has memory 9 | {:position [200 200] 10 | :velocity [2 0]}) 11 | (merge (zigzag/zigzag) ;; zigzag has memory 12 | {:position [200 400] 13 | :velocity [2 0] 14 | :inventory [:cheese]}) 15 | (merge (startstop/startstop) 16 | {:position [600 400] 17 | :velocity [2 0] 18 | :inventory [:cheese]})]) 19 | 20 | (defn settings [] 21 | {}) 22 | 23 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/donor.cljc: -------------------------------------------------------------------------------- 1 | (ns pucks.agents.donor 2 | (:require [pucks.util :as util] 3 | [pucks.agents.active :as active])) 4 | 5 | (defn donor-proposals [p item] 6 | {:rotation (util/relative-position->rotation (:velocity p)) 7 | :transfer (into [] (for [recipient (filter :mobile (:overlaps p))] 8 | {:self (:id p) 9 | :other (:id recipient) 10 | :bid {:inventory item} 11 | :ask {}}))}) 12 | 13 | (defn donor [item] 14 | (merge (active/active) 15 | {:donor true 16 | :inventory [item] 17 | :proposal-function #(donor-proposals % item) 18 | :color [255 0 0]})) -------------------------------------------------------------------------------- /src/pucks/worlds/dev/world4.cljc: -------------------------------------------------------------------------------- 1 | ;; A pucks world. 2 | 3 | (ns pucks.worlds.dev.world4 4 | (:require [pucks.globals :as globals] 5 | [pucks.agents.stone :as stone] 6 | [pucks.agents.linear :as linear])) 7 | 8 | (defn agents [] 9 | (concat (for [y (take 15 (iterate #(+ % 20) 100))] 10 | (merge (stone/stone) {:position [400 y]})) 11 | (for [x (take 16 (iterate #(+ % 20) 50))] 12 | (merge (stone/stone) {:position [x 100]})) 13 | [(merge (linear/linear) 14 | {:position [100 300] 15 | :rotation (/ globals/pi 2) 16 | :velocity [2 0]})])) 17 | 18 | (defn settings [] 19 | {}) 20 | 21 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /bin/pucks/agents/swarmer.clj: -------------------------------------------------------------------------------- 1 | ;; Definitions for swarmer agents. 2 | 3 | (ns pucks.agents.swarmer 4 | (:use [pucks globals util vec2D] 5 | pucks.agents.active)) 6 | 7 | (defn rand-direction [] 8 | (rotation->relative-position (- (rand two-pi) pi))) 9 | 10 | (defn swarmer-proposals [p] 11 | {:acceleration 1 12 | :rotation (relative-position->rotation 13 | (+v (if (empty? (filter :mobile (:sensed p))) 14 | (rotation->relative-position (:rotation p)) 15 | (apply avgv (map :velocity (filter :mobile (:sensed p))))) 16 | (rand-direction)))}) 17 | 18 | (defn swarmer [] 19 | (merge (active) 20 | {:swarmer true 21 | :proposal-function swarmer-proposals})) 22 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | pucks 4 | 5 | 6 | 7 | 8 | 9 | ccw.builder 10 | 11 | 12 | 13 | 14 | ccw.leiningen.builder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.jdt.core.javanature 26 | ccw.leiningen.nature 27 | ccw.nature 28 | 29 | 30 | -------------------------------------------------------------------------------- /resources/public/js/development/propeller/tools/character.cljc: -------------------------------------------------------------------------------- 1 | (ns propeller.tools.character) 2 | 3 | (defn get-ascii 4 | "Gets the ASCII code of a char" 5 | [c] 6 | #?(:clj (int c) 7 | :cljs (.charCodeAt c 0))) 8 | 9 | (defn is-letter 10 | "Returns true if the given character is a letter, A-Z or a-z." 11 | [c] 12 | (<= (get-ascii \A) (get-ascii c) (get-ascii \z))) 13 | 14 | 15 | (defn is-digit 16 | "Returns true if the given character is a digit, 0-9." 17 | [c] 18 | (<= (get-ascii \0) (get-ascii c) (get-ascii \9))) 19 | 20 | 21 | (defn is-whitespace 22 | "Returns true if the given character is whitespace (newline, space, tab)." 23 | [c] 24 | (contains? #{(get-ascii \newline) (get-ascii \tab) (get-ascii \space)} (get-ascii c))) 25 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world4.cljc: -------------------------------------------------------------------------------- 1 | ;; A pucks world. 2 | 3 | (ns pucks.worlds.dev.world4 4 | (:require [pucks.globals :as globals] 5 | [pucks.agents.stone :as stone] 6 | [pucks.agents.linear :as linear])) 7 | 8 | (defn agents [] 9 | (concat (for [y (take 15 (iterate #(+ % 20) 100))] 10 | (merge (stone/stone) {:position [400 y]})) 11 | (for [x (take 16 (iterate #(+ % 20) 50))] 12 | (merge (stone/stone) {:position [x 100]})) 13 | [(merge (linear/linear) 14 | {:position [100 300] 15 | :rotation (/ globals/pi 2) 16 | :velocity [2 0]})])) 17 | 18 | (defn settings [] 19 | {}) 20 | 21 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /resources/public/js/optimized/propeller/tools/character.cljc: -------------------------------------------------------------------------------- 1 | (ns propeller.tools.character) 2 | 3 | (defn get-ascii 4 | "Gets the ASCII code of a char" 5 | [c] 6 | #?(:clj (int c) 7 | :cljs (.charCodeAt c 0))) 8 | 9 | (defn is-letter 10 | "Returns true if the given character is a letter, A-Z or a-z." 11 | [c] 12 | (<= (get-ascii \A) (get-ascii c) (get-ascii \z))) 13 | 14 | 15 | (defn is-digit 16 | "Returns true if the given character is a digit, 0-9." 17 | [c] 18 | (<= (get-ascii \0) (get-ascii c) (get-ascii \9))) 19 | 20 | 21 | (defn is-whitespace 22 | "Returns true if the given character is whitespace (newline, space, tab)." 23 | [c] 24 | (contains? #{(get-ascii \newline) (get-ascii \tab) (get-ascii \space)} (get-ascii c))) 25 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/generic.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/jfong\/projects\/pucks\/resources\/public\/js\/development\/pucks\/agents\/generic.js","sources":["generic.cljc"],"lineCount":16,"mappings":";AAMA;;;;AAIA,+BAAA,\/BAAMA;AAAN,AAAA,+CAAA,8DAAA,+EAAA,uDAAA,wDAAA,uDAAA,0DAAA,wDAAA,0DAAA,sEAAA,8DAAA,8DAAA,wEAAA,wEAAA,6DAAA,kDAAA,8DAAA,+DAAA,yDAAA,+DAOa,CAAGI,uBAAe,AAACD,2BAWV,WAAKE;AAAL,AAAA;GAlBtB,mFAAA,MAAA,MAAA,cAAA,KAAA,IAAA,mCAAA,IAAA,KAAA,IAAA,iCAAA,iCAiBkB,WAAKA;AAAL,AAAA;GAEC,WAAKA;AAAL,AAAA;GAnBnB,mGAAA,iCAAA,MAAA,zGACO,2BAAA,3BAACJ,oCAIK,AAACC,wJACA,CAAA,MAAK,6BAAA,5BAAG,AAACC,kCAAY,CAAA,MAAK,6BAAA,5BAAG,AAACA","names":["pucks.agents.generic\/generic","cljs.core\/gensym","pucks.util\/rand-xy","cljs.core\/rand","pucks.globals\/two-pi","p"]} -------------------------------------------------------------------------------- /src/pucks/agents/torpedo.cljc: -------------------------------------------------------------------------------- 1 | ;; Definitions for torpedo agents. 2 | 3 | (ns pucks.agents.torpedo 4 | (:require [pucks.util :as util] 5 | [pucks.agents.zapper :as zapper] 6 | )) 7 | 8 | (defn torpedo-proposals [p] 9 | {:rotation (util/relative-position->rotation (:velocity p)) 10 | :transfer (into [] (for [victim (filter :mobile (:overlaps p))] 11 | {:self (:id p) 12 | :other (:id victim) 13 | :bid {} 14 | :ask {:energy 1.0}}))}) 15 | 16 | (defn torpedo [] 17 | (merge (zapper/zapper) 18 | {:torpedo true 19 | :mobile true 20 | :proposal-function torpedo-proposals 21 | :color [200 100 0] 22 | :radius 8})) 23 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world17.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/jfong\/projects\/pucks\/resources\/public\/js\/development\/pucks\/worlds\/dev\/world17.js","sources":["world17.cljc"],"lineCount":16,"mappings":";AAAA;;;AAGA,kCAAA,lCAAMA;AAAN,AAAA,0FACG,gEAAA,2CAAA,3GAACC,0BAAM,AAACC,gKAEA,WAAKC;AAAL,AAAA,kDAAA,sEAAA,IAAA,sEAEiB,0GAAA,zGAAG,AAAA,oGAAeA;GAJ3C,8DAAA,mFAAA,MAAA,cAAA,8DAAA,IAAA,6DAAA,mFAAA,IAAA,sBAQA,gEAAA,2CAAA,3GAACF,0BAAM,AAACC,gKAEA,WAAKC;AAAL,AAAA,kDAAA,sEAAA,IAAA,qLAAA,\/GAEiB,0GAAA,zGAAG,AAAA,oGAAeA,wEACtB,kGAAA,jGAAG,AAAA,4FAAWA;GALnC,8DAAA,mFAAA,MAAA,cAAA,8DAAA,IAAA,6DAAA,mFAAA,IAAA;;AAUH,oCAAA,pCAAMC;AAAN,AAAA","names":["pucks.worlds.dev.world17\/agents","cljs.core\/merge","pucks.agents.active\/active","p","pucks.worlds.dev.world17\/settings"]} -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/torpedo.cljc: -------------------------------------------------------------------------------- 1 | ;; Definitions for torpedo agents. 2 | 3 | (ns pucks.agents.torpedo 4 | (:require [pucks.util :as util] 5 | [pucks.agents.zapper :as zapper] 6 | )) 7 | 8 | (defn torpedo-proposals [p] 9 | {:rotation (util/relative-position->rotation (:velocity p)) 10 | :transfer (into [] (for [victim (filter :mobile (:overlaps p))] 11 | {:self (:id p) 12 | :other (:id victim) 13 | :bid {} 14 | :ask {:energy 1.0}}))}) 15 | 16 | (defn torpedo [] 17 | (merge (zapper/zapper) 18 | {:torpedo true 19 | :mobile true 20 | :proposal-function torpedo-proposals 21 | :color [200 100 0] 22 | :radius 8})) 23 | -------------------------------------------------------------------------------- /bin/pucks/agents/generic.clj: -------------------------------------------------------------------------------- 1 | ;; Definitions for generic agents. All other agents should be merged 2 | ;; with (generic), either directly or indirectly. 3 | 4 | ;; All default agent values are defined here. 5 | 6 | 7 | (ns pucks.agents.generic 8 | (:use [pucks globals util])) 9 | 10 | (defn generic [] 11 | {:id (gensym "puck-") 12 | :mobile false 13 | :solid true 14 | :radius 20 15 | :position (rand-xy) 16 | :velocity [(* 5 (- (rand) 0.5)) (* 5 (- (rand) 0.5))] 17 | :rotation (* two-pi (rand)) 18 | :thrust-angle 0 19 | :color [255 255 255] 20 | :energy 1 21 | :steps 0 22 | :neighbors [] 23 | :overlaps [] 24 | :memory {} 25 | :inventory [] 26 | :bound-to [] 27 | :draw-function (fn [p] false) 28 | :proposal-function (fn [p] {}) 29 | :spawn-function (fn [p] {})}) -------------------------------------------------------------------------------- /src/pucks/worlds/ai/world2.cljc: -------------------------------------------------------------------------------- 1 | ;; A pucks world. 2 | 3 | (ns pucks.worlds.ai.world2 4 | (:require [pucks.agents.stone :as stone] 5 | [pucks.agents.user :as user] 6 | [pucks.agents.vent :as vent] 7 | [pucks.agents.zapper :as zapper] 8 | [pucks.globals :as globals])) 9 | 10 | (defn agents [] 11 | (concat (for [y (take 20 (iterate #(+ % 20) 100))] 12 | (merge (stone/stone) {:position [400 y]})) 13 | [(merge (vent/vent) {:position [600 300]}) 14 | (merge (zapper/zapper) {:position [300 300]}) 15 | (merge (user/user) {:position [200 300] 16 | :rotation (/ globals/pi 2) 17 | :velocity [0.1 0]})])) 18 | 19 | (defn settings [] 20 | {}) 21 | 22 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /bin/pucks/agents/stone.clj: -------------------------------------------------------------------------------- 1 | ;; Definitions for stones. 2 | 3 | (ns pucks.agents.stone 4 | (:use quil.core 5 | [pucks globals util vec2D] 6 | pucks.agents.generic)) 7 | 8 | (defn draw-stone [p] 9 | (let [[x y] (:position p) 10 | radius (:radius p) 11 | [r g b] (:color p)] 12 | (push-matrix) 13 | (translate x y) 14 | ;; core 15 | (fill r g b 128) 16 | (ellipse 0 0 radius radius) 17 | ;; membrane 18 | (fill r g b 16) 19 | (ellipse 0 0 (* radius 2) (* radius 2)) 20 | (pop-matrix))) 21 | 22 | (defn stone-proposals [p] 23 | {}) 24 | 25 | (defn stone [] 26 | (merge (generic) 27 | {:stone true 28 | :radius 40 29 | :color [0 0 0] 30 | :draw-function draw-stone 31 | :proposal-function stone-proposals})) 32 | 33 | -------------------------------------------------------------------------------- /src/pucks/agents/stone.cljc: -------------------------------------------------------------------------------- 1 | ;; Definitions for stones. 2 | 3 | (ns pucks.agents.stone 4 | (:require [quil.core :as q] 5 | [pucks.agents.generic :as generic])) 6 | 7 | (defn draw-stone [p] 8 | (let [[x y] (:position p) 9 | radius (:radius p) 10 | [r g b] (:color p)] 11 | (q/push-matrix) 12 | (q/translate x y) 13 | ;; core 14 | (q/fill r g b 128) 15 | (q/ellipse 0 0 radius radius) 16 | ;; membrane 17 | (q/fill r g b 16) 18 | (q/ellipse 0 0 (* radius 2) (* radius 2)) 19 | (q/pop-matrix))) 20 | 21 | (defn stone-proposals [p] 22 | {}) 23 | 24 | (defn stone [] 25 | (merge (generic/generic) 26 | {:stone true 27 | :radius 40 28 | :color [0 0 0] 29 | :draw-function draw-stone 30 | :proposal-function stone-proposals})) 31 | 32 | -------------------------------------------------------------------------------- /src/pucks/worlds/dev/world17.cljc: -------------------------------------------------------------------------------- 1 | (ns pucks.worlds.dev.world17 2 | (:require [pucks.agents.active :as active])) 3 | 4 | (defn agents [] 5 | [(merge (active/active) 6 | {:proposal-function 7 | (fn [p] 8 | {:acceleration 1 9 | :thrust-angle (+ (:thrust-angle p) 0.1)}) 10 | :position [500 500] 11 | :rotation 0 12 | :velocity [0 -2]}) 13 | (merge (active/active) 14 | {:proposal-function 15 | (fn [p] 16 | {:acceleration 1 17 | :thrust-angle (+ (:thrust-angle p) 0.1) 18 | :rotation (- (:rotation p) 0.03)}) 19 | :position [200 200] 20 | :rotation 0 21 | :velocity [0 1]})]) 22 | 23 | (defn settings [] 24 | {}) 25 | 26 | ;(run-pucks (agents) (settings)) 27 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/ai/world2.cljc: -------------------------------------------------------------------------------- 1 | ;; A pucks world. 2 | 3 | (ns pucks.worlds.ai.world2 4 | (:require [pucks.agents.stone :as stone] 5 | [pucks.agents.user :as user] 6 | [pucks.agents.vent :as vent] 7 | [pucks.agents.zapper :as zapper] 8 | [pucks.globals :as globals])) 9 | 10 | (defn agents [] 11 | (concat (for [y (take 20 (iterate #(+ % 20) 100))] 12 | (merge (stone/stone) {:position [400 y]})) 13 | [(merge (vent/vent) {:position [600 300]}) 14 | (merge (zapper/zapper) {:position [300 300]}) 15 | (merge (user/user) {:position [200 300] 16 | :rotation (/ globals/pi 2) 17 | :velocity [0.1 0]})])) 18 | 19 | (defn settings [] 20 | {}) 21 | 22 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /resources/public/js/development/propeller/push/instructions/bool.cljc.cache.json: -------------------------------------------------------------------------------- 1 | ["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ ","~$make-instruction","~$propeller.push.utils.helpers","~$def-instruction","~$propeller.push.utils.macros"],"~:excludes",["~#set",[]],"~:name","~$propeller.push.instructions.bool","~:imports",null,"~:requires",["^ ","^4","^4"],"~:cljs.spec/speced-vars",[],"~:uses",["^ ","^3","^4"],"~:defs",["^ "],"~:cljs.spec/registry-ref",[],"~:require-macros",["^ ","^6","^6"],"~:cljs.analyzer/constants",["^ ","~:seen",["^8",["~:boolean_xor","~:boolean_from_integer","~:float","~:boolean_invert_first_then_and","~:boolean_not","~:integer","~:boolean_from_float","~:boolean_and","~:boolean_invert_second_then_and","~:boolean_or","~:boolean","~:stacks"]],"~:order",["^K","^N","^O","^M","^H","^D","^G","^L","^J","^F","^E","^I"]],"~:doc",null] -------------------------------------------------------------------------------- /resources/public/js/development/propeller/tools/character.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/jfong\/projects\/pucks\/resources\/public\/js\/development\/propeller\/tools\/character.js","sources":["character.cljc"],"lineCount":29,"mappings":";AAAA;;AAEA;;;sCAAA,tCAAMA,oFAEHC;AAFH,AAIW,oBAAA,bAAaA;;AAExB;;;sCAAA,tCAAMC,oFAEHD;AAFH,AAGE,SAAA,8GAAA,7GAAI,8CAAA,9CAACD,sDAAc,wDAAA,xDAACA,wDAAAA,VAAUC,wDAAAA,MAAG,8CAAA,9CAACD;;AAGpC;;;qCAAA,rCAAMG,kFAEHF;AAFH,AAGE,SAAA,8GAAA,7GAAI,8CAAA,9CAACD,sDAAc,wDAAA,xDAACA,wDAAAA,VAAUC,wDAAAA,MAAG,8CAAA,9CAACD;;AAGpC;;;0CAAA,1CAAMI,4FAEHH;AAFH,AAGE,2CAAA,pCAACI,0LAAY,8CAAA,9CAACL,vGAAoB,8CAAA,9CAACA,oDAAgB,8CAAA,9CAACA,yGAAmB,AAACA,8CAAUC","names":["propeller.tools.character\/get-ascii","c","propeller.tools.character\/is-letter","propeller.tools.character\/is-digit","propeller.tools.character\/is-whitespace","cljs.core\/contains?"]} -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world17.cljc: -------------------------------------------------------------------------------- 1 | (ns pucks.worlds.dev.world17 2 | (:require [pucks.agents.active :as active])) 3 | 4 | (defn agents [] 5 | [(merge (active/active) 6 | {:proposal-function 7 | (fn [p] 8 | {:acceleration 1 9 | :thrust-angle (+ (:thrust-angle p) 0.1)}) 10 | :position [500 500] 11 | :rotation 0 12 | :velocity [0 -2]}) 13 | (merge (active/active) 14 | {:proposal-function 15 | (fn [p] 16 | {:acceleration 1 17 | :thrust-angle (+ (:thrust-angle p) 0.1) 18 | :rotation (- (:rotation p) 0.03)}) 19 | :position [200 200] 20 | :rotation 0 21 | :velocity [0 1]})]) 22 | 23 | (defn settings [] 24 | {}) 25 | 26 | ;(run-pucks (agents) (settings)) 27 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/stone.cljc: -------------------------------------------------------------------------------- 1 | ;; Definitions for stones. 2 | 3 | (ns pucks.agents.stone 4 | (:require [quil.core :as q] 5 | [pucks.agents.generic :as generic])) 6 | 7 | (defn draw-stone [p] 8 | (let [[x y] (:position p) 9 | radius (:radius p) 10 | [r g b] (:color p)] 11 | (q/push-matrix) 12 | (q/translate x y) 13 | ;; core 14 | (q/fill r g b 128) 15 | (q/ellipse 0 0 radius radius) 16 | ;; membrane 17 | (q/fill r g b 16) 18 | (q/ellipse 0 0 (* radius 2) (* radius 2)) 19 | (q/pop-matrix))) 20 | 21 | (defn stone-proposals [p] 22 | {}) 23 | 24 | (defn stone [] 25 | (merge (generic/generic) 26 | {:stone true 27 | :radius 40 28 | :color [0 0 0] 29 | :draw-function draw-stone 30 | :proposal-function stone-proposals})) 31 | 32 | -------------------------------------------------------------------------------- /src/pucks/agents/generic.cljc: -------------------------------------------------------------------------------- 1 | ;; Definitions for generic agents. All other agents should be merged 2 | ;; with (generic), either directly or indirectly. 3 | 4 | ;; All default agent values are defined here. 5 | 6 | 7 | (ns pucks.agents.generic 8 | (:require [pucks.globals :as globals] 9 | [pucks.util :as util])) 10 | 11 | (defn generic [] 12 | {:id (gensym "puck-") 13 | :mobile false 14 | :solid true 15 | :radius 20 16 | :position (util/rand-xy) 17 | :velocity [(* 5 (- (rand) 0.5)) (* 5 (- (rand) 0.5))] 18 | :rotation (* globals/two-pi (rand)) 19 | :thrust-angle 0 20 | :color [255 255 255] 21 | :energy 1 22 | :steps 0 23 | :neighbors [] 24 | :overlaps [] 25 | :memory {} 26 | :inventory [] 27 | :bound-to [] 28 | :draw-function (fn [p] false) 29 | :proposal-function (fn [p] {}) 30 | :spawn-function (fn [p] {})}) -------------------------------------------------------------------------------- /resources/public/js/development/propeller/push/core.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 1.10.520 {} 2 | goog.provide('propeller.push.core'); 3 | goog.require('cljs.core'); 4 | propeller.push.core.instruction_table = cljs.core.atom.call(null,cljs.core.PersistentHashMap.EMPTY); 5 | propeller.push.core.opens = new cljs.core.PersistentArrayMap(null, 8, [new cljs.core.Keyword(null,"exec_dup","exec_dup",62681535),(1),new cljs.core.Keyword(null,"exec_if","exec_if",-1891127445),(2),new cljs.core.Keyword(null,"exec_when","exec_when",1360752950),(1),new cljs.core.Keyword(null,"exec_while","exec_while",205430888),(1),new cljs.core.Keyword(null,"exec_do_while","exec_do_while",-1777621384),(1),new cljs.core.Keyword(null,"exec_k","exec_k",-1544818208),(2),new cljs.core.Keyword(null,"exec_s","exec_s",1598630000),(3),new cljs.core.Keyword(null,"exec_y","exec_y",1050974042),(1)], null); 6 | 7 | //# sourceMappingURL=core.js.map 8 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/generic.cljc: -------------------------------------------------------------------------------- 1 | ;; Definitions for generic agents. All other agents should be merged 2 | ;; with (generic), either directly or indirectly. 3 | 4 | ;; All default agent values are defined here. 5 | 6 | 7 | (ns pucks.agents.generic 8 | (:require [pucks.globals :as globals] 9 | [pucks.util :as util])) 10 | 11 | (defn generic [] 12 | {:id (gensym "puck-") 13 | :mobile false 14 | :solid true 15 | :radius 20 16 | :position (util/rand-xy) 17 | :velocity [(* 5 (- (rand) 0.5)) (* 5 (- (rand) 0.5))] 18 | :rotation (* globals/two-pi (rand)) 19 | :thrust-angle 0 20 | :color [255 255 255] 21 | :energy 1 22 | :steps 0 23 | :neighbors [] 24 | :overlaps [] 25 | :memory {} 26 | :inventory [] 27 | :bound-to [] 28 | :draw-function (fn [p] false) 29 | :proposal-function (fn [p] {}) 30 | :spawn-function (fn [p] {})}) -------------------------------------------------------------------------------- /src/pucks/agents/swarmer.cljc: -------------------------------------------------------------------------------- 1 | ;; Definitions for swarmer agents. 2 | 3 | (ns pucks.agents.swarmer 4 | (:require [pucks.util :as util] 5 | [pucks.globals :as globals] 6 | [pucks.vec2D :as vec2D] 7 | [pucks.agents.active :as active])) 8 | 9 | 10 | (defn rand-direction [] 11 | (util/rotation->relative-position (- (rand globals/two-pi) globals/pi))) 12 | 13 | (defn swarmer-proposals [p] 14 | {:acceleration 1 15 | :rotation (util/relative-position->rotation 16 | (vec2D/+v (if (empty? (filter :mobile (:sensed p))) 17 | (util/rotation->relative-position (:rotation p)) 18 | (apply vec2D/avgv (map :velocity (filter :mobile (:sensed p))))) 19 | (rand-direction)))}) 20 | 21 | (defn swarmer [] 22 | (merge (active/active) 23 | {:swarmer true 24 | :proposal-function swarmer-proposals})) 25 | -------------------------------------------------------------------------------- /resources/public/js/development/propeller/push/instructions/character.cljc.cache.json: -------------------------------------------------------------------------------- 1 | ["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ ","~$make-instruction","~$propeller.push.utils.helpers","~$def-instruction","~$propeller.push.utils.macros"],"~:excludes",["~#set",[]],"~:name","~$propeller.push.instructions.character","~:imports",null,"~:requires",["^ ","~$state","~$propeller.push.state","^>","^>","^4","^4","~$char","~$propeller.tools.character","^@","^@"],"~:cljs.spec/speced-vars",[],"~:uses",["^ ","^3","^4"],"~:defs",["^ "],"~:cljs.spec/registry-ref",[],"~:require-macros",["^ ","^6","^6"],"~:cljs.analyzer/constants",["^ ","~:seen",["^8",["~:char_from_float","~:char_all_from_string","~:float","~:char_is_whitespace","~:string","~:char_is_digit","~:integer","~:char_from_integer","~:boolean","~:char","~:stacks","~:char_is_letter"]],"~:order",["^S","^Q","^P","^R","^M","^K","^H","^J","^O","^N","^I","^L"]],"~:doc",null] -------------------------------------------------------------------------------- /resources/public/js/development/pucks/reap.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/jfong\/projects\/pucks\/resources\/public\/js\/development\/pucks\/reap.js","sources":["reap.cljc"],"lineCount":40,"mappings":";AAEA;;;AAGA;;;;kBAAA,lBAAMA;AAAN,AAIE,OAACC,+BAAMC,yBACA,WAAKC;AAAL,AACE,IAAMC,eACA,yBAAA,WAAAC,pCAACC;AAAD,AAAO,oBAAI,iBAAAC,oBAAK,AAAA,uFAAAF;AAAL,AAAA,oBAAAE;AAAiB,UAAK,0GAAA,zGAAM,AAAA,sFAAAF;;AAA5BE;;;AACF,iCAAAF,gBAAA,2CAAA,wDAAA,KAAA,wDAAA,MAAA,sKAAA,yDAAA,MAAA,uDAAA,mFAAA,MAAA,MAAA,cAAA,zlBAACG,gRAEqB,AAAA,qFAAAH,mUAGO,WAAKI;AAAL,AAAA;;;AAN\/BJ;;GAQDF;AATZ,AAWE,mCAAA,5BAACQ;kBAADD;AAAA,AAAU,OAACE,wBAAI,iBAAAL,oBAAK,AAAA,sFAAAG;AAAL,AAAA,oBAAAH;AACK,QAAG,AAAA,qFAAAG,mBACA,kHAAA,jHAAG,AAAA,8FAAAA;;AAFXH;;;;CAGNH","names":["pucks.reap\/reap","cljs.core\/swap!","pucks.globals\/all-agents","objs","with-corpses","p1__7751#","cljs.core\/mapv","and__4120__auto__","cljs.core\/merge","p","p1__7752#","cljs.core\/filterv","cljs.core\/not"]} -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/swarmer.cljc: -------------------------------------------------------------------------------- 1 | ;; Definitions for swarmer agents. 2 | 3 | (ns pucks.agents.swarmer 4 | (:require [pucks.util :as util] 5 | [pucks.globals :as globals] 6 | [pucks.vec2D :as vec2D] 7 | [pucks.agents.active :as active])) 8 | 9 | 10 | (defn rand-direction [] 11 | (util/rotation->relative-position (- (rand globals/two-pi) globals/pi))) 12 | 13 | (defn swarmer-proposals [p] 14 | {:acceleration 1 15 | :rotation (util/relative-position->rotation 16 | (vec2D/+v (if (empty? (filter :mobile (:sensed p))) 17 | (util/rotation->relative-position (:rotation p)) 18 | (apply vec2D/avgv (map :velocity (filter :mobile (:sensed p))))) 19 | (rand-direction)))}) 20 | 21 | (defn swarmer [] 22 | (merge (active/active) 23 | {:swarmer true 24 | :proposal-function swarmer-proposals})) 25 | -------------------------------------------------------------------------------- /resources/public/js/development/propeller/push/instructions/code.cljc.cache.json: -------------------------------------------------------------------------------- 1 | ["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ ","~$make-instruction","~$propeller.push.utils.helpers","~$def-instruction","~$propeller.push.utils.macros"],"~:excludes",["~#set",[]],"~:name","~$propeller.push.instructions.code","~:imports",null,"~:requires",["^ ","~$utils","~$propeller.utils","^>","^>","~$state","~$propeller.push.state","^@","^@","^4","^4"],"~:cljs.spec/speced-vars",[],"~:uses",["^ ","^3","^4"],"~:defs",["^ "],"~:cljs.spec/registry-ref",[],"~:require-macros",["^ ","^6","^6"],"~:cljs.analyzer/constants",["^ ","~:seen",["^8",["~:exec_k","~:exec_do_times","~:code_append","~:else","~:exec","~:exec_while","~:exec_if","~:exec_s","~:integer","~:integer_pop","~:exec_when","~:code","~:exec_do_count","~:exec_do_while","~:exec_y","~:exec_do_range","~:boolean","~:stacks"]],"~:order",["^J","^S","^Y","^W","^L","^P","^K","^T","^I","^Q","^N","^X","^R","^M","^U","^H","^O","^V"]],"~:doc",null] -------------------------------------------------------------------------------- /src/pucks/worlds/dev/world15.cljc: -------------------------------------------------------------------------------- 1 | (ns pucks.worlds.dev.world15 2 | (:require [pucks.agents.swarmevolver :as swarmevolver] 3 | [pucks.agents.nursery :as nursery] 4 | [pucks.agents.vent :as vent] 5 | [pucks.agents.zapper :as zapper])) 6 | 7 | (defn agents [] 8 | (vec (concat 9 | (for [x (range 100 1200 200) 10 | y (range 100 1200 200)] 11 | (assoc (vent/vent) :position [x y])) 12 | [(assoc (zapper/zapper) :position [600 450]) 13 | (assoc (zapper/zapper) :position [450 600]) 14 | (assoc (zapper/zapper) :position [750 600]) 15 | (assoc (zapper/zapper) :position [600 750])] 16 | [(assoc (nursery/nursery swarmevolver/swarmevolver) :position [600 600])]))) 17 | 18 | (defn settings [] 19 | {:screen-size 1200 20 | :scale 0.6 21 | :single-thread-mode false 22 | :nursery-threshold 5 23 | :max-velocity 40 24 | :torpedo-energy 0.02}) 25 | 26 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/zigzag.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/jfong\/projects\/pucks\/resources\/public\/js\/development\/pucks\/agents\/zigzag.js","sources":["zigzag.cljc"],"lineCount":18,"mappings":";AAGA;;;;AAKA,AAAKA,+BAAS,oBAAA,nBAAGC;AAEjB,AAAKC,gCAAU,CAAA,MAAK,oBAAA,nBAAGD;AAEvB,uCAAA,vCAAME,sFAAkBC;AAAxB,AACE,IAAMC,kBAAgB,CAAI,AAAA,4FAAWD,MAAGJ;IAClCM,iBAAe,CAAI,AAAA,4FAAWF,MAAGF;IACjCK,YAAU,+TAAA,uDAAA,pXAAI,EAAIF,qBACA,EAAK,8MAAA,9MAACG,yBAAE,AAAA,yFAAU,AAAA,wFAASJ,iEACtB,GAAKE;AAJlC,AAAA,kDAAA,sEAAA,IAAA,sNAAA,0DAAA,2CAAA,7PAQa,EAAI,mCAAA,nCAACE,yBAAED,iEACLP,6BACAE,+LACMK;;AAEvB,6BAAA,7BAAME;AAAN,AACE,uEAAA,2CAAA,wDAAA,KAAA,oHAAA,uDAAA,mFAAA,MAAA,IAAA,cAAA,0DAAA,2CAAA,2DAAA,9lBAACC,0BAAM,AAACC,6NAEmBR","names":["pucks.agents.zigzag\/leftmost","pucks.globals\/pi","pucks.agents.zigzag\/rightmost","pucks.agents.zigzag\/zigzag-proposals","p","switch-to-right","switch-to-left","direction","cljs.core\/=","pucks.agents.zigzag\/zigzag","cljs.core\/merge","pucks.agents.active\/active"]} -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/spawner.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/jfong\/projects\/pucks\/resources\/public\/js\/development\/pucks\/agents\/spawner.js","sources":["spawner.cljc"],"lineCount":16,"mappings":";AAGA;;;;;AAMA,yCAAA,zCAAMA,0FAAmBC;AAAzB,AACE,iCAAA,2CAAA,sEAAA,IAAA,\/IAACC,6MACiB,AAACC,oDAAiC,AAAA,2FAAWF,YACxD,iDAAA,2CAAA,wDAAA,yNAAA,3WAAI,yCAAA,xCAAO,6BAAA,7BAACG,oOACD,AAAC,AAAA,sGAAiBH,aAAGA;;AAGzC,+BAAA,\/BAAMI;AAAN,AACE,uEAAA,2CAAA,0DAAA,KAAA,sHAAA,uDAAA,mFAAA,IAAA,MAAA,cAAA,wEAAA,WAAAC,rhBAACJ,0BAAM,AAACK,+NAEmBP;AAF3B,AAIyB,iCAAAM,gBAAA,2CAAA,6DAAA,+KAAA,iHAAA,8DAAA,hfAACJ,qOACkB,CAAA,MAAK,6BAAA,5BAAG,AAACM,kCAAY,CAAA,MAAK,6BAAA,5BAAG,AAACA,wGAC\/B,CAAGC,uBAAe,AAACD,4KAElB,qCAAA,pCAAG,6BAAA,7BAACJ,yCAAe,qCAAA,pCAAG,6BAAA,7BAACA","names":["pucks.agents.spawner\/spawner-proposals","p","cljs.core\/merge","pucks.util\/relative-position->rotation","cljs.core\/rand-int","pucks.agents.spawner\/spawner","p1__7853#","pucks.agents.active\/active","cljs.core\/rand","pucks.globals\/two-pi"]} -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world15.cljc: -------------------------------------------------------------------------------- 1 | (ns pucks.worlds.dev.world15 2 | (:require [pucks.agents.swarmevolver :as swarmevolver] 3 | [pucks.agents.nursery :as nursery] 4 | [pucks.agents.vent :as vent] 5 | [pucks.agents.zapper :as zapper])) 6 | 7 | (defn agents [] 8 | (vec (concat 9 | (for [x (range 100 1200 200) 10 | y (range 100 1200 200)] 11 | (assoc (vent/vent) :position [x y])) 12 | [(assoc (zapper/zapper) :position [600 450]) 13 | (assoc (zapper/zapper) :position [450 600]) 14 | (assoc (zapper/zapper) :position [750 600]) 15 | (assoc (zapper/zapper) :position [600 750])] 16 | [(assoc (nursery/nursery swarmevolver/swarmevolver) :position [600 600])]))) 17 | 18 | (defn settings [] 19 | {:screen-size 1200 20 | :scale 0.6 21 | :single-thread-mode false 22 | :nursery-threshold 5 23 | :max-velocity 40 24 | :torpedo-energy 0.02}) 25 | 26 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /resources/public/js/optimized/propeller/utils.cljc: -------------------------------------------------------------------------------- 1 | (ns propeller.utils) 2 | 3 | (defn indexof 4 | "Returns the first index of an element in a collection. If the element is not 5 | present in the collection, returns -1." 6 | [element coll] 7 | (or (first (keep-indexed #(if (= element %2) %1) coll)) -1)) 8 | 9 | (defn not-lazy 10 | "Returns lst if it is not a seq, or a non-lazy version of lst if it is." 11 | [lst] 12 | (if (seq? lst) 13 | (apply list lst) 14 | lst)) 15 | 16 | (defn ensure-list 17 | "Returns a non-lazy list if passed a seq argument. Othwrwise, returns a list 18 | containing the argument." 19 | [thing] 20 | (if (seq? thing) 21 | (not-lazy thing) 22 | (list thing))) 23 | 24 | (defn random-instruction 25 | "Returns a random instruction from a supplied pool of instructions, evaluating 26 | ERC-producing functions to a constant literal." 27 | [instructions] 28 | (let [instruction (rand-nth instructions)] 29 | (if (fn? instruction) 30 | (instruction) 31 | instruction))) 32 | -------------------------------------------------------------------------------- /bin/pucks/agents/zigzag.clj: -------------------------------------------------------------------------------- 1 | ;; Definitions for zigzag agents, which achieve their zigzags by using 2 | ;; memory. 3 | 4 | (ns pucks.agents.zigzag 5 | (:use [pucks globals util vec2D] 6 | pucks.agents.active)) 7 | 8 | (def leftmost (/ pi 4)) 9 | 10 | (def rightmost (* 3 (/ pi 4))) 11 | 12 | (defn zigzag-proposals [p] 13 | (let [switch-to-right (<= (:rotation p) leftmost) 14 | switch-to-left (>= (:rotation p) rightmost) 15 | direction (if (or switch-to-right 16 | (and (= (:turning (:memory p)) :right) 17 | (not switch-to-left))) 18 | :right 19 | :left)] 20 | {:acceleration 1 21 | :rotation (if (= direction :left) 22 | leftmost 23 | rightmost) 24 | :memory {:turning direction}})) 25 | 26 | (defn zigzag [] 27 | (merge (active) 28 | {:zigzag true 29 | :proposal-function zigzag-proposals 30 | :color [255 0 255] 31 | :memory {:turning :left}})) -------------------------------------------------------------------------------- /resources/public/js/development/propeller/utils.cljc: -------------------------------------------------------------------------------- 1 | (ns propeller.utils) 2 | 3 | (defn indexof 4 | "Returns the first index of an element in a collection. If the element is not 5 | present in the collection, returns -1." 6 | [element coll] 7 | (or (first (keep-indexed #(if (= element %2) %1) coll)) -1)) 8 | 9 | (defn not-lazy 10 | "Returns lst if it is not a seq, or a non-lazy version of lst if it is." 11 | [lst] 12 | (if (seq? lst) 13 | (apply list lst) 14 | lst)) 15 | 16 | (defn ensure-list 17 | "Returns a non-lazy list if passed a seq argument. Othwrwise, returns a list 18 | containing the argument." 19 | [thing] 20 | (if (seq? thing) 21 | (not-lazy thing) 22 | (list thing))) 23 | 24 | (defn random-instruction 25 | "Returns a random instruction from a supplied pool of instructions, evaluating 26 | ERC-producing functions to a constant literal." 27 | [instructions] 28 | (let [instruction (rand-nth instructions)] 29 | (if (fn? instruction) 30 | (instruction) 31 | instruction))) 32 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/swarmer.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/jfong\/projects\/pucks\/resources\/public\/js\/development\/pucks\/agents\/swarmer.js","sources":["swarmer.cljc"],"lineCount":18,"mappings":";AAEA;;;;;;AAOA,sCAAA,tCAAMA;AAAN,AACE,OAACC,oDAAiC,CAAG,AAACC,yBAAKC,wBAAgBC;;AAE7D,yCAAA,zCAAMC,0FAAmBC;AAAzB,AAAA,kDAAA,sEAAA,IAAA,8DAEa,AAACC,oDACA,AAACC,8BAAS,EAAI,AAACC,iCAAO,2BAAA,3BAACC,oFAAe,AAAA,uFAASJ,MACzC,AAACL,oDAAiC,AAAA,4FAAWK,IAC7C,AAACK,0BAAMC,iBAAW,wBAAA,xBAACC,qFAAc,2BAAA,3BAACH,oFAAe,AAAA,uFAASJ,OAC5D,AAACN;;AAEnB,+BAAA,\/BAAMc;AAAN,AACE,uEAAA,2CAAA,0DAAA,KAAA,1KAACC,0BAAM,AAACC,+NAEmBX","names":["pucks.agents.swarmer\/rand-direction","pucks.util\/rotation->relative-position","cljs.core\/rand","pucks.globals\/two-pi","pucks.globals\/pi","pucks.agents.swarmer\/swarmer-proposals","p","pucks.util\/relative-position->rotation","pucks.vec2D\/+v","cljs.core\/empty?","cljs.core\/filter","cljs.core\/apply","pucks.vec2D\/avgv","cljs.core\/map","pucks.agents.swarmer\/swarmer","cljs.core\/merge","pucks.agents.active\/active"]} -------------------------------------------------------------------------------- /src/pucks/worlds/dev/world21.cljc: -------------------------------------------------------------------------------- 1 | (ns pucks.worlds.dev.world21 2 | (:require [pucks.agents.spanner :as spanner] 3 | [pucks.agents.nursery :as nursery] 4 | [pucks.agents.vent :as vent])) 5 | 6 | (defn agents [] 7 | [(assoc (vent/vent) :position [100 100]) 8 | (assoc (vent/vent) :position [100 300]) 9 | (assoc (vent/vent) :position [300 100]) 10 | (assoc (vent/vent) :position [300 300]) 11 | (assoc (nursery/nursery spanner/spanner) :position [200 200])]) 12 | 13 | (defn agents [] 14 | (vec (concat 15 | (for [x (range 100 600 200) 16 | y (range 100 600 200)] 17 | (assoc (vent/vent) :position [x y])) 18 | [(assoc (nursery/nursery spanner/spanner) :position [200 200])]))) 19 | 20 | (defn settings [] 21 | {:screen-size 400 22 | :scale 1.5 23 | :single-thread-mode false 24 | :nursery-threshold 25 25 | :neighborhood-size 150 26 | :max-velocity 40 27 | :cost-of-living 0.0001 28 | :cost-of-collision 0.01}) 29 | 30 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /src/pucks/agents/spawner.cljc: -------------------------------------------------------------------------------- 1 | 2 | ;; Definitions for spawner agents. 3 | 4 | (ns pucks.agents.spawner 5 | (:require [pucks.util :as util] 6 | [pucks.globals :as globals] 7 | [pucks.agents.active :as active])) 8 | 9 | 10 | (defn spawner-proposals [p] 11 | (merge {:acceleration 0 12 | :rotation (util/relative-position->rotation (:velocity p))} 13 | (if (zero? (rand-int 250)) 14 | {:spawn [((:spawn-function p) p)]} 15 | {}))) 16 | 17 | (defn spawner [] 18 | (merge (active/active) 19 | {:spawner true 20 | :proposal-function spawner-proposals 21 | :color [0 128 255] 22 | :spawn-function #(merge % 23 | {:velocity [(* 5 (- (rand) 0.5)) (* 5 (- (rand) 0.5))] 24 | :rotation (* globals/two-pi (rand)) 25 | ;; position will be relative to position of parent 26 | :position [(- (rand-int 3) 1) (- (rand-int 3) 1)]})})) 27 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world21.cljc: -------------------------------------------------------------------------------- 1 | (ns pucks.worlds.dev.world21 2 | (:require [pucks.agents.spanner :as spanner] 3 | [pucks.agents.nursery :as nursery] 4 | [pucks.agents.vent :as vent])) 5 | 6 | (defn agents [] 7 | [(assoc (vent/vent) :position [100 100]) 8 | (assoc (vent/vent) :position [100 300]) 9 | (assoc (vent/vent) :position [300 100]) 10 | (assoc (vent/vent) :position [300 300]) 11 | (assoc (nursery/nursery spanner/spanner) :position [200 200])]) 12 | 13 | (defn agents [] 14 | (vec (concat 15 | (for [x (range 100 600 200) 16 | y (range 100 600 200)] 17 | (assoc (vent/vent) :position [x y])) 18 | [(assoc (nursery/nursery spanner/spanner) :position [200 200])]))) 19 | 20 | (defn settings [] 21 | {:screen-size 400 22 | :scale 1.5 23 | :single-thread-mode false 24 | :nursery-threshold 25 25 | :neighborhood-size 150 26 | :max-velocity 40 27 | :cost-of-living 0.0001 28 | :cost-of-collision 0.01}) 29 | 30 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/user.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 1.10.520 {} 2 | goog.provide('pucks.agents.user'); 3 | goog.require('cljs.core'); 4 | goog.require('pucks.util'); 5 | goog.require('pucks.agents.active'); 6 | pucks.agents.user.user_proposals = (function pucks$agents$user$user_proposals(p){ 7 | return new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"acceleration","acceleration",-1213888421),(0),new cljs.core.Keyword(null,"rotation","rotation",-1728051644),pucks.util.relative_position__GT_rotation.call(null,new cljs.core.Keyword(null,"velocity","velocity",-581524355).cljs$core$IFn$_invoke$arity$1(p))], null); 8 | }); 9 | pucks.agents.user.user = (function pucks$agents$user$user(){ 10 | return cljs.core.merge.call(null,pucks.agents.active.active.call(null),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"user","user",1532431356),true,new cljs.core.Keyword(null,"proposal-function","proposal-function",-646608988),pucks.agents.user.user_proposals], null)); 11 | }); 12 | 13 | //# sourceMappingURL=user.js.map 14 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world1.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/jfong\/projects\/pucks\/resources\/public\/js\/development\/pucks\/worlds\/dev\/world1.js","sources":["world1.cljc"],"lineCount":29,"mappings":";AAEA;;;;;;;;;;AAWA,iCAAA,jCAAMA;AAAN,AACE,2NAAA,pNAACC,2BAAO,+BAAA,\/BAACC,oCAAcC,0BACf,+BAAA,\/BAACD,oCAAcE,wBACf,+BAAA,\/BAACF,mCAAaG,+GACb,uCAAA,vCAACC;AAAD,AAAkB,uEAAA,2CAAA,8DAAA,mFAAA,5PAACC,0BAAM,AAACC;YAHnC,mFAIS,uCAAA,vCAACF;AAAD,AAAkB,yEAAA,2CAAA,0DAAA,2CAAA,8DAAA,hRAACC,0BAAM,AAACE;YAJnC,mFAKS,uCAAA,vCAACH;AAAD,AAAkB,GAAI,uCAAA,tCAAO,6BAAA,7BAACI;AAAa,OAACF;;AAAe,OAACG;;YALrE,mFAMS,AAACL,uCAAgBG,sCAClB,+BAAA,\/BAACP,mCAAaU;;AAGxB,mCAAA,nCAAMC;AAAN,AAAA","names":["pucks.worlds.dev.world1\/agents","cljs.core\/concat","cljs.core\/repeatedly","pucks.agents.stone\/stone","pucks.agents.vent\/vent","pucks.agents.zapper\/zapper","pucks.agents.nursery\/nursery","cljs.core\/merge","pucks.agents.linear\/linear","pucks.agents.swarmer\/swarmer","cljs.core\/rand-int","pucks.agents.shooter\/shooter","pucks.agents.beacon\/beacon","pucks.worlds.dev.world1\/settings"]} -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/spawner.cljc: -------------------------------------------------------------------------------- 1 | 2 | ;; Definitions for spawner agents. 3 | 4 | (ns pucks.agents.spawner 5 | (:require [pucks.util :as util] 6 | [pucks.globals :as globals] 7 | [pucks.agents.active :as active])) 8 | 9 | 10 | (defn spawner-proposals [p] 11 | (merge {:acceleration 0 12 | :rotation (util/relative-position->rotation (:velocity p))} 13 | (if (zero? (rand-int 250)) 14 | {:spawn [((:spawn-function p) p)]} 15 | {}))) 16 | 17 | (defn spawner [] 18 | (merge (active/active) 19 | {:spawner true 20 | :proposal-function spawner-proposals 21 | :color [0 128 255] 22 | :spawn-function #(merge % 23 | {:velocity [(* 5 (- (rand) 0.5)) (* 5 (- (rand) 0.5))] 24 | :rotation (* globals/two-pi (rand)) 25 | ;; position will be relative to position of parent 26 | :position [(- (rand-int 3) 1) (- (rand-int 3) 1)]})})) 27 | -------------------------------------------------------------------------------- /resources/public/js/development/propeller/utils.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/jfong\/projects\/pucks\/resources\/public\/js\/development\/propeller\/utils.js","sources":["utils.cljc"],"lineCount":56,"mappings":";AAAA;;AAEA;;;;0BAAA,1BAAMA,4DAGHC,QAAQC;AAHX,AAIE,IAAAC,mBAAI,AAACC,0BAAM,iCAAA,WAAAC,gBAAAC,5DAACC;AAAD,AAAe,GAAI,iCAAAD,jCAACE,yBAAEP;AAAPI;;AAAA;;GAAuBH;AAAjD,AAAA,oBAAAC;AAAAA;;AAAA;;;AAEF;;;2BAAA,3BAAMM,8DAEHC;AAFH,AAGE,GAAI,AAACC,+BAAKD;AACR,OAACE,0BAAMC,eAAKH;;AACZA;;;AAEJ;;;;8BAAA,9BAAMI,oEAGHC;AAHH,AAIE,GAAI,AAACJ,+BAAKI;AACR,OAACN,mCAASM;;AACV,YAAAC,eAAA,WAAA,KAAA,IAAA,fAAMD;;;AAEV;;;;qCAAA,rCAAME,kFAGHC;AAHH,AAIE,IAAMC,cAAY,AAACC,6BAASF;AAA5B,AACE,GAAI,AAACG,8BAAIF;AACP,OAACA;;AACDA","names":["propeller.utils\/indexof","element","coll","or__4131__auto__","cljs.core\/first","p1__3707#","p2__3706#","cljs.core\/keep-indexed","cljs.core\/=","propeller.utils\/not-lazy","lst","cljs.core\/seq?","cljs.core\/apply","cljs.core\/list","propeller.utils\/ensure-list","thing","cljs.core\/List","propeller.utils\/random-instruction","instructions","instruction","cljs.core\/rand-nth","cljs.core\/fn?"]} -------------------------------------------------------------------------------- /src/pucks/agents/zigzag.cljc: -------------------------------------------------------------------------------- 1 | ;; Definitions for zigzag agents, which achieve their zigzags by using 2 | ;; memory. 3 | 4 | (ns pucks.agents.zigzag 5 | (:require [pucks.globals :as globals] 6 | [pucks.agents.active :as active])) 7 | 8 | 9 | (def leftmost (/ globals/pi 4)) 10 | 11 | (def rightmost (* 3 (/ globals/pi 4))) 12 | 13 | (defn zigzag-proposals [p] 14 | (let [switch-to-right (<= (:rotation p) leftmost) 15 | switch-to-left (>= (:rotation p) rightmost) 16 | direction (if (or switch-to-right 17 | (and (= (:turning (:memory p)) :right) 18 | (not switch-to-left))) 19 | :right 20 | :left)] 21 | {:acceleration 1 22 | :rotation (if (= direction :left) 23 | leftmost 24 | rightmost) 25 | :memory {:turning direction}})) 26 | 27 | (defn zigzag [] 28 | (merge (active/active) 29 | {:zigzag true 30 | :proposal-function zigzag-proposals 31 | :color [255 0 255] 32 | :memory {:turning :left}})) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/zigzag.cljc: -------------------------------------------------------------------------------- 1 | ;; Definitions for zigzag agents, which achieve their zigzags by using 2 | ;; memory. 3 | 4 | (ns pucks.agents.zigzag 5 | (:require [pucks.globals :as globals] 6 | [pucks.agents.active :as active])) 7 | 8 | 9 | (def leftmost (/ globals/pi 4)) 10 | 11 | (def rightmost (* 3 (/ globals/pi 4))) 12 | 13 | (defn zigzag-proposals [p] 14 | (let [switch-to-right (<= (:rotation p) leftmost) 15 | switch-to-left (>= (:rotation p) rightmost) 16 | direction (if (or switch-to-right 17 | (and (= (:turning (:memory p)) :right) 18 | (not switch-to-left))) 19 | :right 20 | :left)] 21 | {:acceleration 1 22 | :rotation (if (= direction :left) 23 | leftmost 24 | rightmost) 25 | :memory {:turning direction}})) 26 | 27 | (defn zigzag [] 28 | (merge (active/active) 29 | {:zigzag true 30 | :proposal-function zigzag-proposals 31 | :color [255 0 255] 32 | :memory {:turning :left}})) -------------------------------------------------------------------------------- /src/pucks/worlds/dev/world1.cljc: -------------------------------------------------------------------------------- 1 | ;; A pucks world. 2 | 3 | (ns pucks.worlds.dev.world1 4 | (:require [pucks.agents.shooter :as shooter] 5 | [pucks.agents.zapper :as zapper] 6 | [pucks.agents.nursery :as nursery] 7 | [pucks.agents.vent :as vent] 8 | [pucks.agents.beacon :as beacon] 9 | [pucks.agents.shooter :as shooter] 10 | [pucks.agents.stone :as stone] 11 | [pucks.agents.swarmer :as swarmer] 12 | [pucks.agents.linear :as linear])) 13 | 14 | (defn agents [] 15 | (concat (repeatedly 10 stone/stone) 16 | (repeatedly 10 vent/vent) 17 | (repeatedly 5 zapper/zapper) 18 | [(nursery/nursery #(merge (linear/linear) {:inventory [:something]}))] 19 | [(nursery/nursery #(merge (swarmer/swarmer) {:memory {:something :rembered}}))] 20 | [(nursery/nursery #(if (zero? (rand-int 2)) (linear/linear) (shooter/shooter)))] 21 | [(nursery/nursery swarmer/swarmer)] 22 | (repeatedly 2 beacon/beacon))) 23 | 24 | 25 | (defn settings [] 26 | {}) 27 | 28 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /resources/public/js/optimized/pucks/agents/linear.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 1.10.520 {:static-fns true, :optimize-constants true} 2 | goog.provide('pucks.agents.linear'); 3 | goog.require('cljs.core'); 4 | goog.require('cljs.core.constants'); 5 | goog.require('pucks.util'); 6 | goog.require('pucks.agents.active'); 7 | pucks.agents.linear.linear_proposals = (function pucks$agents$linear$linear_proposals(p){ 8 | return new cljs.core.PersistentArrayMap(null, 2, [cljs.core.cst$kw$acceleration,(0),cljs.core.cst$kw$rotation,pucks.util.relative_position__GT_rotation(cljs.core.cst$kw$velocity.cljs$core$IFn$_invoke$arity$1(p))], null); 9 | }); 10 | pucks.agents.linear.linear = (function pucks$agents$linear$linear(){ 11 | return cljs.core.merge.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([pucks.agents.active.active(),new cljs.core.PersistentArrayMap(null, 3, [cljs.core.cst$kw$linear,true,cljs.core.cst$kw$proposal_DASH_function,pucks.agents.linear.linear_proposals,cljs.core.cst$kw$color,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [(0),(0),(255)], null)], null)], 0)); 12 | }); 13 | -------------------------------------------------------------------------------- /src/pucks/agents/mapdonor.cljc: -------------------------------------------------------------------------------- 1 | (ns pucks.agents.mapdonor 2 | (:require [pucks.util :as util] 3 | [pucks.globals :as globals] 4 | [pucks.agents.active :as active])) 5 | 6 | 7 | (defn mapdonor-proposals [p] 8 | (merge {:rotation (util/relative-position->rotation (:velocity p))} 9 | {:transfer (vec (for [recipient (filter :mobile (:overlaps p))] 10 | {:self (:id p) 11 | :other (:id recipient) 12 | :bid {:memory {:map (:map (:memory p))}} 13 | :ask {}}))} 14 | {:memory {:map (let [unmapped [:neighbors :overlaps :sensed 15 | :inventory :memory :draw-function 16 | :proposals :proposal-function :spawn-function]] 17 | (mapv #(apply dissoc (cons % unmapped)) @globals/all-agents))}})) 18 | 19 | (defn mapdonor [] 20 | (merge (active/active) 21 | {:mapdonor true 22 | :proposal-function mapdonor-proposals 23 | :color [255 96 255] 24 | :core-color [255 96 255]})) 25 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world1.cljc: -------------------------------------------------------------------------------- 1 | ;; A pucks world. 2 | 3 | (ns pucks.worlds.dev.world1 4 | (:require [pucks.agents.shooter :as shooter] 5 | [pucks.agents.zapper :as zapper] 6 | [pucks.agents.nursery :as nursery] 7 | [pucks.agents.vent :as vent] 8 | [pucks.agents.beacon :as beacon] 9 | [pucks.agents.shooter :as shooter] 10 | [pucks.agents.stone :as stone] 11 | [pucks.agents.swarmer :as swarmer] 12 | [pucks.agents.linear :as linear])) 13 | 14 | (defn agents [] 15 | (concat (repeatedly 10 stone/stone) 16 | (repeatedly 10 vent/vent) 17 | (repeatedly 5 zapper/zapper) 18 | [(nursery/nursery #(merge (linear/linear) {:inventory [:something]}))] 19 | [(nursery/nursery #(merge (swarmer/swarmer) {:memory {:something :rembered}}))] 20 | [(nursery/nursery #(if (zero? (rand-int 2)) (linear/linear) (shooter/shooter)))] 21 | [(nursery/nursery swarmer/swarmer)] 22 | (repeatedly 2 beacon/beacon))) 23 | 24 | 25 | (defn settings [] 26 | {}) 27 | 28 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /src/pucks/draw.cljc: -------------------------------------------------------------------------------- 1 | ;; Draws the pucks world by setting the background color and 2 | ;; drawing all agents to the display using their :draw-functions. 3 | 4 | (ns pucks.draw 5 | (:require [quil.core :as q] 6 | [pucks.globals :as globals] 7 | [pucks.vec2D :as vec2D])) 8 | 9 | 10 | (defn draw-agents 11 | "Sets the background color and calls the :draw-functions of all agents." 12 | [] 13 | (q/background 230 180 230) 14 | (let [s (:scale @globals/pucks-settings)] 15 | (q/scale s s)) 16 | (doseq [a @globals/all-agents] 17 | ((:draw-function a) a)) 18 | ;; draw bonds, but only if they don't cross a world edge 19 | (let [agent-map (zipmap (map :id @globals/all-agents) @globals/all-agents)] 20 | (q/stroke 196) 21 | (q/stroke-weight 2) 22 | (doseq [a @globals/all-agents] 23 | (doseq [bound-id (:bound-to a)] 24 | (let [[ax ay] (:position a) 25 | [bx by] (:position (get agent-map bound-id))] 26 | (when (< (- (vec2D/length (vec2D/-v [ax ay] [bx by])) 1) 27 | (vec2D/distance [ax ay] [bx by])) 28 | (q/line ax ay bx by))))) 29 | (q/no-stroke))) 30 | -------------------------------------------------------------------------------- /src/pucks/reap.cljc: -------------------------------------------------------------------------------- 1 | ;; Reaper for pucks; converts dead agents to corpses and eventually removes them. 2 | 3 | (ns pucks.reap 4 | (:require [pucks.globals :as globals])) 5 | 6 | (defn reap 7 | "Converts agents with no remaining energy to corpses and eventually 8 | removes them from the world." 9 | [] 10 | (swap! globals/all-agents 11 | (fn [objs] 12 | (let [with-corpses 13 | (mapv #(if (and (:mobile %) (not (pos? (:energy %)))) 14 | (merge % {:corpse true 15 | :solid false 16 | :death-step (:steps %) 17 | :mobile false 18 | :color [100 100 100] 19 | :proposal-function (fn [p] {})}) 20 | %) 21 | objs)] 22 | ;; eliminate corpses that are fully rotted 23 | (filterv #(not (and (:corpse %) 24 | (> (:steps %) 25 | (+ (:death-step %) 30)))) 26 | with-corpses))))) -------------------------------------------------------------------------------- /bin/pucks/agents/zapper.clj: -------------------------------------------------------------------------------- 1 | ;; Definitions for zapper agents. 2 | 3 | (ns pucks.agents.zapper 4 | (:use quil.core 5 | [pucks globals util vec2D] 6 | pucks.agents.generic)) 7 | 8 | (defn draw-zapper [p] 9 | (let [[x y] (:position p) 10 | radius (:radius p) 11 | [r g b] (:color p)] 12 | (push-matrix) 13 | (translate x y) 14 | ;; membrane 15 | (fill r g b 100) 16 | (ellipse 0 0 (* radius 2) (* radius 2)) 17 | ;; core 18 | (fill r g b) 19 | (ellipse 0 0 radius radius) 20 | (pop-matrix))) 21 | 22 | ;; Take energy from any overlapping mobile agent, without giving anything in 23 | ;; return. 24 | 25 | (defn zapper-proposals [p] 26 | {:transfer (into [] (for [victim (filter :mobile (:overlaps p))] 27 | {:self (:id p) 28 | :other (:id victim) 29 | :bid {} 30 | :ask {:energy 0.1}}))}) 31 | 32 | (defn zapper [] 33 | (merge (generic) 34 | {:zapper true 35 | :radius 50 36 | :color [207 19 200] 37 | :draw-function draw-zapper 38 | :proposal-function zapper-proposals})) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/mapdonor.cljc: -------------------------------------------------------------------------------- 1 | (ns pucks.agents.mapdonor 2 | (:require [pucks.util :as util] 3 | [pucks.globals :as globals] 4 | [pucks.agents.active :as active])) 5 | 6 | 7 | (defn mapdonor-proposals [p] 8 | (merge {:rotation (util/relative-position->rotation (:velocity p))} 9 | {:transfer (vec (for [recipient (filter :mobile (:overlaps p))] 10 | {:self (:id p) 11 | :other (:id recipient) 12 | :bid {:memory {:map (:map (:memory p))}} 13 | :ask {}}))} 14 | {:memory {:map (let [unmapped [:neighbors :overlaps :sensed 15 | :inventory :memory :draw-function 16 | :proposals :proposal-function :spawn-function]] 17 | (mapv #(apply dissoc (cons % unmapped)) @globals/all-agents))}})) 18 | 19 | (defn mapdonor [] 20 | (merge (active/active) 21 | {:mapdonor true 22 | :proposal-function mapdonor-proposals 23 | :color [255 96 255] 24 | :core-color [255 96 255]})) 25 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/globals.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/jfong\/projects\/pucks\/resources\/public\/js\/development\/pucks\/globals.js","sources":["globals.cljc"],"lineCount":19,"mappings":";AAEA;;AAIA,AAAKA,2BAAW,yBAAA,zBAACC;AAEjB,AAAKC,0BAAU,yBAAA,zBAACD;AAEhB,AAAKE,8BAAc,yBAAA,zBAACF;AAEpB,AAAKG,uBAAO,yBAAA,zBAACH;AAEb,AAAKI,wCAAwB,yBAAA,zBAACJ;AAE9B,AAAKK,uBAAO,yBAAA,zBAACL;AAKb,AAAKM,+BACH,yBAAA,wCAAA,gFAAA,+GAAA,uDAAA,6FAAA,6EAAA,kEAAA,wEAAA,iFAAA,yEAAA,yEAAA,8DAAA,6EAAA,+EAAA,0FAAA,sEAAA,sEAAA,MAAA,MAAA,IAAA,IAAA,OAAA,MAAA,IAAA,KAAA,MAAA,KAAA,KAAA,IAAA,KAAA,KAAA,KAAA,31CAACN;AAmBH,AAAKO,mBAAGC;AAER,AAAKC,uBAAO,CAAA,MAAKD;AAEjB,AAAKE,wBAAQ,WAAA,VAAGF;AAEhB,AAAKG,2BAAW,WAAA,VAAGH;AAEnB,AAAKI,wBAAQ,CAAA,MAAKH;AAElB,AAAKI,yBAAS,GAAGN;AAEjB,AAAKO,6BAAa,GAAGL","names":["pucks.globals\/all-agents","cljs.core\/atom","pucks.globals\/iteration","pucks.globals\/last-input-ms","pucks.globals\/paused","pucks.globals\/number-of-active-agents","pucks.globals\/end-ms","pucks.globals\/pucks-settings","pucks.globals\/pi","Math\/PI","pucks.globals\/two-pi","pucks.globals\/half-pi","pucks.globals\/quarter-pi","pucks.globals\/four-pi","pucks.globals\/minus-pi","pucks.globals\/minus-two-pi"]} -------------------------------------------------------------------------------- /src/pucks/agents/zapper.cljc: -------------------------------------------------------------------------------- 1 | ;; Definitions for zapper agents. 2 | 3 | (ns pucks.agents.zapper 4 | (:require [quil.core :as q] 5 | [pucks.agents.generic :as generic])) 6 | 7 | (defn draw-zapper [p] 8 | (let [[x y] (:position p) 9 | radius (:radius p) 10 | [r g b] (:color p)] 11 | (q/push-matrix) 12 | (q/translate x y) 13 | ;; membrane 14 | (q/fill r g b 100) 15 | (q/ellipse 0 0 (* radius 2) (* radius 2)) 16 | ;; core 17 | (q/fill r g b) 18 | (q/ellipse 0 0 radius radius) 19 | (q/pop-matrix))) 20 | 21 | ;; Take energy from any overlapping mobile agent, without giving anything in 22 | ;; return. 23 | 24 | (defn zapper-proposals [p] 25 | {:transfer (into [] (for [victim (filter :mobile (:overlaps p))] 26 | {:self (:id p) 27 | :other (:id victim) 28 | :bid {} 29 | :ask {:energy 0.1}}))}) 30 | 31 | (defn zapper [] 32 | (merge (generic/generic) 33 | {:zapper true 34 | :radius 50 35 | :color [207 19 200] 36 | :draw-function draw-zapper 37 | :proposal-function zapper-proposals})) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/draw.cljc: -------------------------------------------------------------------------------- 1 | ;; Draws the pucks world by setting the background color and 2 | ;; drawing all agents to the display using their :draw-functions. 3 | 4 | (ns pucks.draw 5 | (:require [quil.core :as q] 6 | [pucks.globals :as globals] 7 | [pucks.vec2D :as vec2D])) 8 | 9 | 10 | (defn draw-agents 11 | "Sets the background color and calls the :draw-functions of all agents." 12 | [] 13 | (q/background 230 180 230) 14 | (let [s (:scale @globals/pucks-settings)] 15 | (q/scale s s)) 16 | (doseq [a @globals/all-agents] 17 | ((:draw-function a) a)) 18 | ;; draw bonds, but only if they don't cross a world edge 19 | (let [agent-map (zipmap (map :id @globals/all-agents) @globals/all-agents)] 20 | (q/stroke 196) 21 | (q/stroke-weight 2) 22 | (doseq [a @globals/all-agents] 23 | (doseq [bound-id (:bound-to a)] 24 | (let [[ax ay] (:position a) 25 | [bx by] (:position (get agent-map bound-id))] 26 | (when (< (- (vec2D/length (vec2D/-v [ax ay] [bx by])) 1) 27 | (vec2D/distance [ax ay] [bx by])) 28 | (q/line ax ay bx by))))) 29 | (q/no-stroke))) 30 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/reap.cljc: -------------------------------------------------------------------------------- 1 | ;; Reaper for pucks; converts dead agents to corpses and eventually removes them. 2 | 3 | (ns pucks.reap 4 | (:require [pucks.globals :as globals])) 5 | 6 | (defn reap 7 | "Converts agents with no remaining energy to corpses and eventually 8 | removes them from the world." 9 | [] 10 | (swap! globals/all-agents 11 | (fn [objs] 12 | (let [with-corpses 13 | (mapv #(if (and (:mobile %) (not (pos? (:energy %)))) 14 | (merge % {:corpse true 15 | :solid false 16 | :death-step (:steps %) 17 | :mobile false 18 | :color [100 100 100] 19 | :proposal-function (fn [p] {})}) 20 | %) 21 | objs)] 22 | ;; eliminate corpses that are fully rotted 23 | (filterv #(not (and (:corpse %) 24 | (> (:steps %) 25 | (+ (:death-step %) 30)))) 26 | with-corpses))))) -------------------------------------------------------------------------------- /resources/public/js/optimized/quil/middlewares/deprecated_options.cljc: -------------------------------------------------------------------------------- 1 | (ns quil.middlewares.deprecated-options) 2 | 3 | (def ^:private deprecated 4 | {:decor ["2.0" "Try :features [:present] for similar effect"] 5 | :target ["2.0" "Use :features [:keep-on-top] instead."] 6 | :safe-draw-fn ["2.0" "Use :features [:no-safe-fns] instead."]}) 7 | 8 | (defn- check-features-vector [features] 9 | (let [features (set features)] 10 | (when (features :no-safe-draw) 11 | (println "Feature :no-safe-draw was renamed to :no-safe-fns in Quil 2.1." 12 | "Use :feature [:no-safe-fns] now.")) 13 | (disj features :no-safe-draw))) 14 | 15 | (defn deprecated-options 16 | "Checks `options` map for deprecated options, removes them and 17 | prints messages explaining how to fix them." 18 | [options] 19 | (let [options (update-in options [:features] check-features-vector)] 20 | (->> (for [[name value] options] 21 | (if-let [[version message] (deprecated name)] 22 | (do (println name "option was removed in Quil" version "." message) 23 | nil) 24 | [name value])) 25 | (remove nil?) 26 | (into {})))) 27 | -------------------------------------------------------------------------------- /resources/public/js/development/quil/middlewares/deprecated_options.cljc: -------------------------------------------------------------------------------- 1 | (ns quil.middlewares.deprecated-options) 2 | 3 | (def ^:private deprecated 4 | {:decor ["2.0" "Try :features [:present] for similar effect"] 5 | :target ["2.0" "Use :features [:keep-on-top] instead."] 6 | :safe-draw-fn ["2.0" "Use :features [:no-safe-fns] instead."]}) 7 | 8 | (defn- check-features-vector [features] 9 | (let [features (set features)] 10 | (when (features :no-safe-draw) 11 | (println "Feature :no-safe-draw was renamed to :no-safe-fns in Quil 2.1." 12 | "Use :feature [:no-safe-fns] now.")) 13 | (disj features :no-safe-draw))) 14 | 15 | (defn deprecated-options 16 | "Checks `options` map for deprecated options, removes them and 17 | prints messages explaining how to fix them." 18 | [options] 19 | (let [options (update-in options [:features] check-features-vector)] 20 | (->> (for [[name value] options] 21 | (if-let [[version message] (deprecated name)] 22 | (do (println name "option was removed in Quil" version "." message) 23 | nil) 24 | [name value])) 25 | (remove nil?) 26 | (into {})))) 27 | -------------------------------------------------------------------------------- /resources/public/js/development/propeller/push/core.cljc.cache.json: -------------------------------------------------------------------------------- 1 | ["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$propeller.push.core","~:imports",null,"~:requires",null,"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$instruction-table",["^ ","^5","~$propeller.push.core/instruction-table","~:file","resources/public/js/development/propeller/push/core.cljc","~:line",5,"~:column",1,"~:end-line",5,"~:end-column",23,"~:meta",["^ ","^>","/Users/jfong/projects/pucks/resources/public/js/development/propeller/push/core.cljc","^?",5,"^@",6,"^A",5,"^B",23],"~:tag","~$cljs.core/Atom"],"~$opens",["^ ","^5","~$propeller.push.core/opens","^>","resources/public/js/development/propeller/push/core.cljc","^?",8,"^@",1,"^A",8,"^B",11,"^C",["^ ","^>","/Users/jfong/projects/pucks/resources/public/js/development/propeller/push/core.cljc","^?",8,"^@",6,"^A",8,"^B",11],"^D","~$cljs.core/IMap"]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^4",["~:exec_k","~:exec_while","~:exec_if","~:exec_s","~:exec_when","~:exec_do_while","~:exec_y","~:exec_dup"]],"~:order",["^T","^O","^Q","^N","^R","^M","^P","^S"]],"~:doc",null] -------------------------------------------------------------------------------- /src/pucks/worlds/dev/world23.cljc: -------------------------------------------------------------------------------- 1 | (ns pucks.worlds.dev.world23 2 | (:require [pucks.agents.stone :as stone] 3 | [pucks.agents.nursery :as nursery] 4 | [pucks.agents.vent :as vent] 5 | [pucks.agents.shooter :as shooter])) 6 | 7 | (defn horizontal-wall [[x-min x-max] y] 8 | (for [x (range x-min x-max 20)] 9 | (merge (stone/stone) {:position [x y]}))) 10 | 11 | (defn vertical-wall [x [y-min y-max]] 12 | (for [y (range y-min y-max 20)] 13 | (merge (stone/stone) {:position [x y]}))) 14 | 15 | (defn agents [] 16 | [(assoc (nursery/nursery shooter/shooter) :position [200 200] :solid false) 17 | (assoc (vent/vent) :position [400 400] :solid false) 18 | (assoc (vent/vent) :position [500 100] :solid false) 19 | (assoc (vent/vent) :position [100 500] :solid false) 20 | (assoc (vent/vent) :position [266 466] :solid false) 21 | (assoc (vent/vent) :position [466 266] :solid false)]) 22 | 23 | (defn settings [] 24 | {:screen-size 600 25 | :scale 1.0 26 | :single-thread-mode false 27 | :nursery-threshold 1000 28 | :neighborhood-size 150 29 | :cost-of-collision 0.01 30 | }) 31 | 32 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/zapper.cljc: -------------------------------------------------------------------------------- 1 | ;; Definitions for zapper agents. 2 | 3 | (ns pucks.agents.zapper 4 | (:require [quil.core :as q] 5 | [pucks.agents.generic :as generic])) 6 | 7 | (defn draw-zapper [p] 8 | (let [[x y] (:position p) 9 | radius (:radius p) 10 | [r g b] (:color p)] 11 | (q/push-matrix) 12 | (q/translate x y) 13 | ;; membrane 14 | (q/fill r g b 100) 15 | (q/ellipse 0 0 (* radius 2) (* radius 2)) 16 | ;; core 17 | (q/fill r g b) 18 | (q/ellipse 0 0 radius radius) 19 | (q/pop-matrix))) 20 | 21 | ;; Take energy from any overlapping mobile agent, without giving anything in 22 | ;; return. 23 | 24 | (defn zapper-proposals [p] 25 | {:transfer (into [] (for [victim (filter :mobile (:overlaps p))] 26 | {:self (:id p) 27 | :other (:id victim) 28 | :bid {} 29 | :ask {:energy 0.1}}))}) 30 | 31 | (defn zapper [] 32 | (merge (generic/generic) 33 | {:zapper true 34 | :radius 50 35 | :color [207 19 200] 36 | :draw-function draw-zapper 37 | :proposal-function zapper-proposals})) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/stone.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/jfong\/projects\/pucks\/resources\/public\/js\/development\/pucks\/agents\/stone.js","sources":["stone.cljc"],"lineCount":36,"mappings":";AAEA;;;;AAIA,gCAAA,hCAAMA,wEAAYC;AAAlB,AACE,IAAAC,YAAY,AAAA,4FAAWD;QAAvB,AAAAE,wBAAAD,UAAA,IAAA,1CAAOG;QAAP,AAAAF,wBAAAD,UAAA,IAAA,1CAASI;IACHC,SAAO,AAAA,wFAASN;IADtBG,YAEc,AAAA,qFAAQH;QAFtB,AAAAE,wBAAAC,UAAA,IAAA,1CAEOI;QAFP,AAAAL,wBAAAC,UAAA,IAAA,1CAESK;QAFT,AAAAN,wBAAAC,UAAA,IAAA,1CAEWM;AAFX,AAGE,AAACC;;AACD,AAACC,8BAAYP,EAAEC;;AAEf,+BAAA,\/BAACO,yBAAOL,EAAEC,EAAEC;;AACZ,4BAAA,IAAA,hCAACI,oCAAcP,OAAOA;;AAEtB,+BAAA,\/BAACM,yBAAOL,EAAEC,EAAEC;;AACZ,4BAAA,IAAA,hCAACI,oCAAc,UAAA,TAAGP,cAAU,UAAA,TAAGA;;AAC\/B,OAACQ;;AAEL,qCAAA,rCAAMC,kFAAiBf;AAAvB,AAAA;;AAGA,2BAAA,3BAAMgB;AAAN,AACE,yEAAA,2CAAA,sDAAA,KAAA,0DAAA,KAAA,uDAAA,mFAAA,IAAA,IAAA,YAAA,sGAAA,3eAACC,0BAAM,AAACC,mbAIenB,6GACIgB","names":["pucks.agents.stone\/draw-stone","p","vec__6556","cljs.core\/nth","vec__6559","x","y","radius","r","g","b","quil.core\/push-matrix","quil.core\/translate","quil.core\/fill","quil.core\/ellipse","quil.core\/pop-matrix","pucks.agents.stone\/stone-proposals","pucks.agents.stone\/stone","cljs.core\/merge","pucks.agents.generic\/generic"]} -------------------------------------------------------------------------------- /resources/public/js/optimized/pucks/agents/shooter.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 1.10.520 {:static-fns true, :optimize-constants true} 2 | goog.provide('pucks.agents.shooter'); 3 | goog.require('cljs.core'); 4 | goog.require('cljs.core.constants'); 5 | goog.require('pucks.util'); 6 | goog.require('pucks.agents.active'); 7 | pucks.agents.shooter.shooter_proposals = (function pucks$agents$shooter$shooter_proposals(p){ 8 | return new cljs.core.PersistentArrayMap(null, 3, [cljs.core.cst$kw$acceleration,(0),cljs.core.cst$kw$rotation,pucks.util.relative_position__GT_rotation(cljs.core.cst$kw$velocity.cljs$core$IFn$_invoke$arity$1(p)),cljs.core.cst$kw$fire_DASH_torpedo,(cljs.core.rand_int((20)) === (0))], null); 9 | }); 10 | pucks.agents.shooter.shooter = (function pucks$agents$shooter$shooter(){ 11 | return cljs.core.merge.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([pucks.agents.active.active(),new cljs.core.PersistentArrayMap(null, 3, [cljs.core.cst$kw$linear,true,cljs.core.cst$kw$proposal_DASH_function,pucks.agents.shooter.shooter_proposals,cljs.core.cst$kw$color,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [(255),(0),(0)], null)], null)], 0)); 12 | }); 13 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/sensors.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/jfong\/projects\/pucks\/resources\/public\/js\/development\/pucks\/sensors.js","sources":["sensors.cljc"],"lineCount":32,"mappings":";AAEA;;;;;AAKA,sBAAA,tBAAMA,oDACHC;AADH,AAAA;AAIE,mCAAA,5BAACC,0BAAMD,2DAEA,yBAAA,WAAAE,pCAACC;AAAD,qFACS,0BAAAD,gBAAA,+DAAA,zGAACD,1BACD,qKAAA,6DAAA,lOAACA,1BACD,8RAAA,0DAAA,xVAACA,jCACD,6ZAAA,8DAAA,pdAACA;GACJ,4BAAA,WAAAG,vCAACC;AAAD,AAAU,IAAAC,oBAAK,iBAAMC,qBACA,AAACC,SAAS,CAAG,AAAA,4FAAWR,KACX,AAACS,oDAAiC,AAAA,4FAAAL;AAFrD,AAGE,SAAI,CAAIG,sBAAmBG,4BACvB,CAAIH,sBAAmB,CAAGI,mBAAWD;;AAJhD,AAAA,GAAAJ;AAKK,QAAI,CAAG,AAACM,6BAAa,AAAA,4FAAAR,oBAAe,AAAA,wFAAAA,qBAChC,AAAA,kGAAA,AAAAS,0BAAgBC;;AANzBR;;GAOF,AAAA,6FAAYN;;AAEnC;;;;4BAAA,5BAAMe;AAAN,AAIE,OAACC,+BAAMC,yBACA,WAAKC;AAAL,AACE,OAACC,8BAAcpB,oBAAMmB","names":["pucks.sensors\/sense","p","cljs.core\/assoc","p1__7071#","cljs.core\/mapv","p1__7072#","cljs.core\/filterv","and__4120__auto__","angular-difference","Math\/abs","pucks.util\/relative-position->rotation","pucks.globals\/half-pi","pucks.globals\/pi","pucks.vec2D\/length","cljs.core\/deref","pucks.globals\/pucks-settings","pucks.sensors\/run-sensors","cljs.core\/swap!","pucks.globals\/all-agents","objs","pucks.util\/pmapallv"]} -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world23.cljc: -------------------------------------------------------------------------------- 1 | (ns pucks.worlds.dev.world23 2 | (:require [pucks.agents.stone :as stone] 3 | [pucks.agents.nursery :as nursery] 4 | [pucks.agents.vent :as vent] 5 | [pucks.agents.shooter :as shooter])) 6 | 7 | (defn horizontal-wall [[x-min x-max] y] 8 | (for [x (range x-min x-max 20)] 9 | (merge (stone/stone) {:position [x y]}))) 10 | 11 | (defn vertical-wall [x [y-min y-max]] 12 | (for [y (range y-min y-max 20)] 13 | (merge (stone/stone) {:position [x y]}))) 14 | 15 | (defn agents [] 16 | [(assoc (nursery/nursery shooter/shooter) :position [200 200] :solid false) 17 | (assoc (vent/vent) :position [400 400] :solid false) 18 | (assoc (vent/vent) :position [500 100] :solid false) 19 | (assoc (vent/vent) :position [100 500] :solid false) 20 | (assoc (vent/vent) :position [266 466] :solid false) 21 | (assoc (vent/vent) :position [466 266] :solid false)]) 22 | 23 | (defn settings [] 24 | {:screen-size 600 25 | :scale 1.0 26 | :single-thread-mode false 27 | :nursery-threshold 1000 28 | :neighborhood-size 150 29 | :cost-of-collision 0.01 30 | }) 31 | 32 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /resources/public/js/optimized/pucks/agents/startstop.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 1.10.520 {:static-fns true, :optimize-constants true} 2 | goog.provide('pucks.agents.startstop'); 3 | goog.require('cljs.core'); 4 | goog.require('cljs.core.constants'); 5 | goog.require('pucks.vec2D'); 6 | goog.require('pucks.agents.active'); 7 | pucks.agents.startstop.startstop_proposals = (function pucks$agents$startstop$startstop_proposals(p){ 8 | return new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$acceleration,(((cljs.core.mod(cljs.core.cst$kw$steps.cljs$core$IFn$_invoke$arity$1(p),(50)) < (25)))?(1):(0.25 * (- pucks.vec2D.length(cljs.core.cst$kw$velocity.cljs$core$IFn$_invoke$arity$1(p)))))], null); 9 | }); 10 | pucks.agents.startstop.startstop = (function pucks$agents$startstop$startstop(){ 11 | return cljs.core.merge.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([pucks.agents.active.active(),new cljs.core.PersistentArrayMap(null, 3, [cljs.core.cst$kw$startstop,true,cljs.core.cst$kw$proposal_DASH_function,pucks.agents.startstop.startstop_proposals,cljs.core.cst$kw$color,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [(96),(255),(96)], null)], null)], 0)); 12 | }); 13 | -------------------------------------------------------------------------------- /src/pucks/agents/opener.cljc: -------------------------------------------------------------------------------- 1 | (ns pucks.agents.opener 2 | (:require [pucks.util :as util] 3 | [pucks.agents.active :as active])) 4 | 5 | (defn opener-proposals [p] 6 | {:acceleration 0 7 | :rotation (util/relative-position->rotation (:velocity p)) 8 | :transfer (vec (concat 9 | ;; ask for a key from anyone 10 | (for [anyone (:overlaps p)] 11 | {:self (:id p) 12 | :other (:id anyone) 13 | :bid {:request {:inventory :key}} 14 | :ask {:inventory :key}}) 15 | ;; offer a key to a gate that promises to open for a positive amount of time 16 | (for [gate (filter :gate (:overlaps p))] 17 | {:self (:id p) 18 | :other (:id gate) 19 | :bid {:inventory :key} 20 | :ask (fn [my-bid your-bid] 21 | (when-let [open-promise (:open (:promise your-bid))] 22 | (pos? open-promise)))})))}) 23 | 24 | (defn opener [] 25 | (merge (active/active) 26 | {:opener true 27 | :proposal-function opener-proposals})) 28 | -------------------------------------------------------------------------------- /src/pucks/worlds/dev/world22.cljc: -------------------------------------------------------------------------------- 1 | (ns pucks.worlds.dev.world22 2 | (:require 3 | [pucks.agents.spanner :as spanner] 4 | [pucks.agents.nursery :as nursery] 5 | [pucks.agents.stone :as stone] 6 | [pucks.agents.vent :as vent])) 7 | 8 | (defn horizontal-wall [[x-min x-max] y] 9 | (for [x (range x-min x-max 20)] 10 | (merge (stone/stone) {:position [x y]}))) 11 | 12 | (defn vertical-wall [x [y-min y-max]] 13 | (for [y (range y-min y-max 20)] 14 | (merge (stone/stone) {:position [x y]}))) 15 | 16 | (defn agents [] 17 | (vec (concat 18 | (for [x (range 100 1200 200) 19 | y (range 100 1200 200)] 20 | (assoc (vent/vent) :position [x y] :mobile false :solid false)) 21 | (for [x (range 50 1200 100) 22 | y (range 50 1200 100)] 23 | (assoc (stone/stone) :position [x y] :mobile false)) 24 | [(assoc (nursery/nursery spanner/spanner) :position [600 600] :solid false)]))) 25 | 26 | (defn settings [] 27 | {:screen-size 1200 28 | :scale 0.6 29 | :single-thread-mode false 30 | :nursery-threshold 1 ;20 ;1000 31 | :neighborhood-size 150 32 | :cost-of-collision 0.01 33 | }) 34 | 35 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/draw.cljc.cache.json: -------------------------------------------------------------------------------- 1 | ["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$pucks.draw","~:imports",null,"~:requires",["^ ","~$q","~$quil.core","^9","^9","~$globals","~$pucks.globals","^;","^;","~$vec2D","~$pucks.vec2D","^=","^="],"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$draw-agents",["^ ","~:protocol-inline",null,"~:meta",["^ ","~:file","/Users/jfong/projects/pucks/src/pucks/draw.cljc","~:line",10,"~:column",7,"~:end-line",10,"~:end-column",18,"~:arglists",["~#list",["~$quote",["^J",[[]]]]],"~:doc","Sets the background color and calls the :draw-functions of all agents."],"^5","~$pucks.draw/draw-agents","^D","src/pucks/draw.cljc","^H",18,"~:method-params",["^J",[[]]],"~:protocol-impl",null,"~:arglists-meta",["^J",[null,null]],"^F",1,"~:variadic?",false,"^E",10,"~:ret-tag",["^4",[null,"~$any"]],"^G",10,"~:max-fixed-arity",0,"~:fn-var",true,"^I",["^J",["^K",["^J",[[]]]]],"^L","Sets the background color and calls the :draw-functions of all agents."]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^4",["~:scale","~:bound-to","~:draw-function","~:id","~:position"]],"~:order",["^Z","^10","^11","^[","^12"]],"^L",null] -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/linear.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 1.10.520 {} 2 | goog.provide('pucks.agents.linear'); 3 | goog.require('cljs.core'); 4 | goog.require('pucks.util'); 5 | goog.require('pucks.agents.active'); 6 | pucks.agents.linear.linear_proposals = (function pucks$agents$linear$linear_proposals(p){ 7 | return new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"acceleration","acceleration",-1213888421),(0),new cljs.core.Keyword(null,"rotation","rotation",-1728051644),pucks.util.relative_position__GT_rotation.call(null,new cljs.core.Keyword(null,"velocity","velocity",-581524355).cljs$core$IFn$_invoke$arity$1(p))], null); 8 | }); 9 | pucks.agents.linear.linear = (function pucks$agents$linear$linear(){ 10 | return cljs.core.merge.call(null,pucks.agents.active.active.call(null),new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"linear","linear",872268697),true,new cljs.core.Keyword(null,"proposal-function","proposal-function",-646608988),pucks.agents.linear.linear_proposals,new cljs.core.Keyword(null,"color","color",1011675173),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [(0),(0),(255)], null)], null)); 11 | }); 12 | 13 | //# sourceMappingURL=linear.js.map 14 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/opener.cljc: -------------------------------------------------------------------------------- 1 | (ns pucks.agents.opener 2 | (:require [pucks.util :as util] 3 | [pucks.agents.active :as active])) 4 | 5 | (defn opener-proposals [p] 6 | {:acceleration 0 7 | :rotation (util/relative-position->rotation (:velocity p)) 8 | :transfer (vec (concat 9 | ;; ask for a key from anyone 10 | (for [anyone (:overlaps p)] 11 | {:self (:id p) 12 | :other (:id anyone) 13 | :bid {:request {:inventory :key}} 14 | :ask {:inventory :key}}) 15 | ;; offer a key to a gate that promises to open for a positive amount of time 16 | (for [gate (filter :gate (:overlaps p))] 17 | {:self (:id p) 18 | :other (:id gate) 19 | :bid {:inventory :key} 20 | :ask (fn [my-bid your-bid] 21 | (when-let [open-promise (:open (:promise your-bid))] 22 | (pos? open-promise)))})))}) 23 | 24 | (defn opener [] 25 | (merge (active/active) 26 | {:opener true 27 | :proposal-function opener-proposals})) 28 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world22.cljc: -------------------------------------------------------------------------------- 1 | (ns pucks.worlds.dev.world22 2 | (:require 3 | [pucks.agents.spanner :as spanner] 4 | [pucks.agents.nursery :as nursery] 5 | [pucks.agents.stone :as stone] 6 | [pucks.agents.vent :as vent])) 7 | 8 | (defn horizontal-wall [[x-min x-max] y] 9 | (for [x (range x-min x-max 20)] 10 | (merge (stone/stone) {:position [x y]}))) 11 | 12 | (defn vertical-wall [x [y-min y-max]] 13 | (for [y (range y-min y-max 20)] 14 | (merge (stone/stone) {:position [x y]}))) 15 | 16 | (defn agents [] 17 | (vec (concat 18 | (for [x (range 100 1200 200) 19 | y (range 100 1200 200)] 20 | (assoc (vent/vent) :position [x y] :mobile false :solid false)) 21 | (for [x (range 50 1200 100) 22 | y (range 50 1200 100)] 23 | (assoc (stone/stone) :position [x y] :mobile false)) 24 | [(assoc (nursery/nursery spanner/spanner) :position [600 600] :solid false)]))) 25 | 26 | (defn settings [] 27 | {:screen-size 1200 28 | :scale 0.6 29 | :single-thread-mode false 30 | :nursery-threshold 1 ;20 ;1000 31 | :neighborhood-size 150 32 | :cost-of-collision 0.01 33 | }) 34 | 35 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/reap.cljc.cache.json: -------------------------------------------------------------------------------- 1 | ["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$pucks.reap","~:imports",null,"~:requires",["^ ","~$globals","~$pucks.globals","^:","^:"],"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$reap",["^ ","~:protocol-inline",null,"~:meta",["^ ","~:file","/Users/jfong/projects/pucks/src/pucks/reap.cljc","~:line",6,"~:column",7,"~:end-line",6,"~:end-column",11,"~:arglists",["~#list",["~$quote",["^G",[[]]]]],"~:doc","Converts agents with no remaining energy to corpses and eventually\n removes them from the world."],"^5","~$pucks.reap/reap","^A","src/pucks/reap.cljc","^E",11,"~:method-params",["^G",[[]]],"~:protocol-impl",null,"~:arglists-meta",["^G",[null,null]],"^C",1,"~:variadic?",false,"^B",6,"~:ret-tag",["^4",[null,"~$any"]],"^D",6,"~:max-fixed-arity",0,"~:fn-var",true,"^F",["^G",["^H",["^G",[[]]]]],"^I","Converts agents with no remaining energy to corpses and eventually\n removes them from the world."]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^4",["~:corpse","~:proposal-function","~:color","~:solid","~:steps","~:energy","~:death-step","~:mobile"]],"~:order",["^12","^10","^W","^Z","^11","^Y","^X","^["]],"^I",null] -------------------------------------------------------------------------------- /resources/public/js/development/goog/dom/htmlelement.js: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | goog.provide('goog.dom.HtmlElement'); 16 | 17 | 18 | 19 | /** 20 | * This subclass of HTMLElement is used when only a HTMLElement is possible and 21 | * not any of its subclasses. Normally, a type can refer to an instance of 22 | * itself or an instance of any subtype. More concretely, if HTMLElement is used 23 | * then the compiler must assume that it might still be e.g. HTMLScriptElement. 24 | * With this, the type check knows that it couldn't be any special element. 25 | * 26 | * @constructor 27 | * @extends {HTMLElement} 28 | */ 29 | goog.dom.HtmlElement = function() {}; 30 | -------------------------------------------------------------------------------- /resources/public/js/development/propeller/selection.cljc: -------------------------------------------------------------------------------- 1 | (ns propeller.selection) 2 | 3 | (defn tournament-selection 4 | "Selects an individual from the population using a tournament." 5 | [pop argmap] 6 | (let [tournament-size (:tournament-size argmap) 7 | tournament-set (take tournament-size (shuffle pop))] 8 | (apply min-key :total-error tournament-set))) 9 | 10 | (defn lexicase-selection 11 | "Selects an individual from the population using lexicase selection." 12 | [pop argmap] 13 | (loop [survivors (map rand-nth (vals (group-by :errors pop))) 14 | cases (shuffle (range (count (:errors (first pop)))))] 15 | (if (or (empty? cases) 16 | (empty? (rest survivors))) 17 | (rand-nth survivors) 18 | (let [min-err-for-case (apply min (map #(nth % (first cases)) 19 | (map :errors survivors)))] 20 | (recur (filter #(= (nth (:errors %) (first cases)) min-err-for-case) 21 | survivors) 22 | (rest cases)))))) 23 | 24 | (defn select-parent 25 | "Selects a parent from the population using the specified method." 26 | [pop argmap] 27 | (case (:parent-selection argmap) 28 | :tournament (tournament-selection pop argmap) 29 | :lexicase (lexicase-selection pop argmap))) 30 | -------------------------------------------------------------------------------- /resources/public/js/optimized/goog/dom/htmlelement.js: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | goog.provide('goog.dom.HtmlElement'); 16 | 17 | 18 | 19 | /** 20 | * This subclass of HTMLElement is used when only a HTMLElement is possible and 21 | * not any of its subclasses. Normally, a type can refer to an instance of 22 | * itself or an instance of any subtype. More concretely, if HTMLElement is used 23 | * then the compiler must assume that it might still be e.g. HTMLScriptElement. 24 | * With this, the type check knows that it couldn't be any special element. 25 | * 26 | * @constructor 27 | * @extends {HTMLElement} 28 | */ 29 | goog.dom.HtmlElement = function() {}; 30 | -------------------------------------------------------------------------------- /resources/public/js/optimized/propeller/selection.cljc: -------------------------------------------------------------------------------- 1 | (ns propeller.selection) 2 | 3 | (defn tournament-selection 4 | "Selects an individual from the population using a tournament." 5 | [pop argmap] 6 | (let [tournament-size (:tournament-size argmap) 7 | tournament-set (take tournament-size (shuffle pop))] 8 | (apply min-key :total-error tournament-set))) 9 | 10 | (defn lexicase-selection 11 | "Selects an individual from the population using lexicase selection." 12 | [pop argmap] 13 | (loop [survivors (map rand-nth (vals (group-by :errors pop))) 14 | cases (shuffle (range (count (:errors (first pop)))))] 15 | (if (or (empty? cases) 16 | (empty? (rest survivors))) 17 | (rand-nth survivors) 18 | (let [min-err-for-case (apply min (map #(nth % (first cases)) 19 | (map :errors survivors)))] 20 | (recur (filter #(= (nth (:errors %) (first cases)) min-err-for-case) 21 | survivors) 22 | (rest cases)))))) 23 | 24 | (defn select-parent 25 | "Selects a parent from the population using the specified method." 26 | [pop argmap] 27 | (case (:parent-selection argmap) 28 | :tournament (tournament-selection pop argmap) 29 | :lexicase (lexicase-selection pop argmap))) 30 | -------------------------------------------------------------------------------- /bin/pucks/agents/beacon.clj: -------------------------------------------------------------------------------- 1 | ;; Definitions for beacon agents. 2 | 3 | (ns pucks.agents.beacon 4 | (:use quil.core 5 | [pucks globals util vec2D] 6 | pucks.agents.generic)) 7 | 8 | (defn draw-beacon [p] 9 | (let [[x y] (:position p) 10 | radius (:radius p) 11 | [r g b] (:color p)] 12 | (push-matrix) 13 | (translate x y) 14 | ;; membrane 15 | (fill r g b 32) 16 | (ellipse 0 0 (* radius 2) (* radius 2)) 17 | ;; core 18 | (ellipse 0 0 radius radius) 19 | (fill 0 0 0) 20 | (text-align :center) 21 | (text (str (:id p)) 0 0) 22 | (pop-matrix))) 23 | 24 | (defn beacon-proposals [p] 25 | {}) 26 | 27 | ;; Beacons are defined to be the maximal size compatible with the provided 28 | ;; sensor range and neighborhood size: 29 | ;; 30 | ;; beacon-radius + sensor-range = neighborhood-size 31 | ;; => beacon-radius = neighborhood-size - sensor-range 32 | 33 | (defn beacon [] 34 | (merge (generic) 35 | {:beacon true 36 | :solid false 37 | :color [255 255 128] 38 | :radius (- (:neighborhood-size @pucks-settings) 39 | (:sensor-range @pucks-settings)) 40 | :draw-function draw-beacon 41 | :proposal-function beacon-proposals 42 | :id (gensym "beacon-") 43 | :position (rand-xy)})) -------------------------------------------------------------------------------- /resources/public/js/development/propeller/push/utils/globals.cljc: -------------------------------------------------------------------------------- 1 | (ns propeller.push.utils.globals) 2 | 3 | ;; ============================================================================= 4 | ;; Values used by the Push instructions to keep the stack sizes within 5 | ;; reasonable limits. 6 | ;; ============================================================================= 7 | 8 | ;; Limits the number of items that can be duplicated onto a stack at once. 9 | ;; We might want to extend this to limit all the different that things may be 10 | ;; placed on a stack. 11 | (def max-stack-items 100) 12 | 13 | 14 | 15 | ;; ============================================================================= 16 | ;; Values used by the Push instructions to keep computed values within 17 | ;; reasonable size limits. 18 | ;; ============================================================================= 19 | 20 | ;; Used by keep-number-reasonable as the maximum magnitude of any integer/float 21 | (def max-number-magnitude 1.0E6) 22 | 23 | ;; Used by keep-number-reasonable as the minimum magnitude of any float 24 | (def min-number-magnitude 1.0E-6) 25 | 26 | ;; Used by reasonable-string-length? to ensure that strings don't get too large 27 | (def max-string-length 1000) 28 | 29 | ;; Used by keep-vector-reasonable to ensure that vectors don't get too large 30 | (def max-vector-length 1000) -------------------------------------------------------------------------------- /resources/public/js/optimized/propeller/push/utils/globals.cljc: -------------------------------------------------------------------------------- 1 | (ns propeller.push.utils.globals) 2 | 3 | ;; ============================================================================= 4 | ;; Values used by the Push instructions to keep the stack sizes within 5 | ;; reasonable limits. 6 | ;; ============================================================================= 7 | 8 | ;; Limits the number of items that can be duplicated onto a stack at once. 9 | ;; We might want to extend this to limit all the different that things may be 10 | ;; placed on a stack. 11 | (def max-stack-items 100) 12 | 13 | 14 | 15 | ;; ============================================================================= 16 | ;; Values used by the Push instructions to keep computed values within 17 | ;; reasonable size limits. 18 | ;; ============================================================================= 19 | 20 | ;; Used by keep-number-reasonable as the maximum magnitude of any integer/float 21 | (def max-number-magnitude 1.0E6) 22 | 23 | ;; Used by keep-number-reasonable as the minimum magnitude of any float 24 | (def min-number-magnitude 1.0E-6) 25 | 26 | ;; Used by reasonable-string-length? to ensure that strings don't get too large 27 | (def max-string-length 1000) 28 | 29 | ;; Used by keep-vector-reasonable to ensure that vectors don't get too large 30 | (def max-vector-length 1000) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/startstop.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 1.10.520 {} 2 | goog.provide('pucks.agents.startstop'); 3 | goog.require('cljs.core'); 4 | goog.require('pucks.vec2D'); 5 | goog.require('pucks.agents.active'); 6 | pucks.agents.startstop.startstop_proposals = (function pucks$agents$startstop$startstop_proposals(p){ 7 | return new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"acceleration","acceleration",-1213888421),(((cljs.core.mod.call(null,new cljs.core.Keyword(null,"steps","steps",-128433302).cljs$core$IFn$_invoke$arity$1(p),(50)) < (25)))?(1):(0.25 * (- pucks.vec2D.length.call(null,new cljs.core.Keyword(null,"velocity","velocity",-581524355).cljs$core$IFn$_invoke$arity$1(p)))))], null); 8 | }); 9 | pucks.agents.startstop.startstop = (function pucks$agents$startstop$startstop(){ 10 | return cljs.core.merge.call(null,pucks.agents.active.active.call(null),new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"startstop","startstop",1058765070),true,new cljs.core.Keyword(null,"proposal-function","proposal-function",-646608988),pucks.agents.startstop.startstop_proposals,new cljs.core.Keyword(null,"color","color",1011675173),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [(96),(255),(96)], null)], null)); 11 | }); 12 | 13 | //# sourceMappingURL=startstop.js.map 14 | -------------------------------------------------------------------------------- /bin/pucks/sensors.clj: -------------------------------------------------------------------------------- 1 | ;; Sensor functions for pucks. 2 | 3 | (ns pucks.sensors 4 | (:use [pucks globals util vec2D])) 5 | 6 | (defn sense 7 | [p] 8 | "Sense everything in neighborhood, in the direction puck is facing, that is 9 | within sensor range." 10 | (assoc p 11 | :sensed 12 | (mapv #(-> % ;; strip features that can't be sensed 13 | (assoc :neighbors []) 14 | (assoc :overlaps []) 15 | (assoc :memory {}) 16 | (assoc :inventory [])) 17 | (filterv #(and (let [angular-difference ;; in front of me 18 | (Math/abs (- (:rotation p) 19 | (relative-position->rotation (:position %))))] 20 | (or (<= angular-difference half-pi) 21 | (>= angular-difference (+ pi half-pi)))) 22 | (<= (- (length (:position %)) (:radius %)) ;; within range 23 | (:sensor-range @pucks-settings))) 24 | (:neighbors p))))) 25 | 26 | (defn run-sensors 27 | "Annotates all agents with the other agents that they can sense, as the value 28 | for the :sensed key." 29 | [] 30 | (swap! all-agents 31 | (fn [objs] 32 | (pmapallv sense objs)))) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/shooter.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 1.10.520 {} 2 | goog.provide('pucks.agents.shooter'); 3 | goog.require('cljs.core'); 4 | goog.require('pucks.util'); 5 | goog.require('pucks.agents.active'); 6 | pucks.agents.shooter.shooter_proposals = (function pucks$agents$shooter$shooter_proposals(p){ 7 | return new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"acceleration","acceleration",-1213888421),(0),new cljs.core.Keyword(null,"rotation","rotation",-1728051644),pucks.util.relative_position__GT_rotation.call(null,new cljs.core.Keyword(null,"velocity","velocity",-581524355).cljs$core$IFn$_invoke$arity$1(p)),new cljs.core.Keyword(null,"fire-torpedo","fire-torpedo",-299372637),(cljs.core.rand_int.call(null,(20)) === (0))], null); 8 | }); 9 | pucks.agents.shooter.shooter = (function pucks$agents$shooter$shooter(){ 10 | return cljs.core.merge.call(null,pucks.agents.active.active.call(null),new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"linear","linear",872268697),true,new cljs.core.Keyword(null,"proposal-function","proposal-function",-646608988),pucks.agents.shooter.shooter_proposals,new cljs.core.Keyword(null,"color","color",1011675173),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [(255),(0),(0)], null)], null)); 11 | }); 12 | 13 | //# sourceMappingURL=shooter.js.map 14 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/generic.cljc.cache.json: -------------------------------------------------------------------------------- 1 | ["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$pucks.agents.generic","~:imports",null,"~:requires",["^ ","~$globals","~$pucks.globals","^:","^:","~$util","~$pucks.util","^<","^<"],"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$generic",["^ ","~:protocol-inline",null,"~:meta",["^ ","~:file","/Users/jfong/projects/pucks/src/pucks/agents/generic.cljc","~:line",11,"~:column",7,"~:end-line",11,"~:end-column",14,"~:arglists",["~#list",["~$quote",["^I",[[]]]]]],"^5","~$pucks.agents.generic/generic","^C","/Users/jfong/projects/pucks/src/pucks/agents/generic.cljc","^G",14,"~:method-params",["^I",[[]]],"~:protocol-impl",null,"~:arglists-meta",["^I",[null,null]],"^E",1,"~:variadic?",false,"^D",11,"~:ret-tag","~$cljs.core/IMap","^F",11,"~:max-fixed-arity",0,"~:fn-var",true,"^H",["^I",["^J",["^I",[[]]]]]]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^4",["~:rotation","~:proposal-function","~:color","~:solid","~:steps","~:memory","~:energy","~:radius","~:thrust-angle","~:inventory","~:bound-to","~:draw-function","~:spawn-function","~:overlaps","~:id","~:position","~:neighbors","~:mobile","~:velocity"]],"~:order",["^X","^Y","^Z","^[","^10","^11","^12","^13","^14","^15","^16","^17","^18","^19","^1:","^1;","^1<","^1=","^1>"]],"~:doc",null] -------------------------------------------------------------------------------- /resources/public/js/development/goog/math/irect.js: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview A record declaration to allow ClientRect and other rectangle 17 | * like objects to be used with goog.math.Rect. 18 | */ 19 | 20 | goog.provide('goog.math.IRect'); 21 | 22 | 23 | /** 24 | * Record for representing rectangular regions, allows compatibility between 25 | * things like ClientRect and goog.math.Rect. 26 | * 27 | * @record 28 | */ 29 | goog.math.IRect = function() {}; 30 | 31 | 32 | /** @type {number} */ 33 | goog.math.IRect.prototype.left; 34 | 35 | 36 | /** @type {number} */ 37 | goog.math.IRect.prototype.top; 38 | 39 | 40 | /** @type {number} */ 41 | goog.math.IRect.prototype.width; 42 | 43 | 44 | /** @type {number} */ 45 | goog.math.IRect.prototype.height; 46 | -------------------------------------------------------------------------------- /resources/public/js/optimized/goog/math/irect.js: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview A record declaration to allow ClientRect and other rectangle 17 | * like objects to be used with goog.math.Rect. 18 | */ 19 | 20 | goog.provide('goog.math.IRect'); 21 | 22 | 23 | /** 24 | * Record for representing rectangular regions, allows compatibility between 25 | * things like ClientRect and goog.math.Rect. 26 | * 27 | * @record 28 | */ 29 | goog.math.IRect = function() {}; 30 | 31 | 32 | /** @type {number} */ 33 | goog.math.IRect.prototype.left; 34 | 35 | 36 | /** @type {number} */ 37 | goog.math.IRect.prototype.top; 38 | 39 | 40 | /** @type {number} */ 41 | goog.math.IRect.prototype.width; 42 | 43 | 44 | /** @type {number} */ 45 | goog.math.IRect.prototype.height; 46 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world2.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 1.10.520 {} 2 | goog.provide('pucks.worlds.dev.world2'); 3 | goog.require('cljs.core'); 4 | goog.require('pucks.globals'); 5 | goog.require('pucks.agents.vent'); 6 | goog.require('pucks.agents.linear'); 7 | pucks.worlds.dev.world2.agents = (function pucks$worlds$dev$world2$agents(){ 8 | return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.merge.call(null,pucks.agents.linear.linear.call(null),new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"position","position",-2011731912),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(100),(300)], null),new cljs.core.Keyword(null,"rotation","rotation",-1728051644),(pucks.globals.pi / (2)),new cljs.core.Keyword(null,"velocity","velocity",-581524355),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(2),(0)], null)], null)),cljs.core.merge.call(null,pucks.agents.vent.vent.call(null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"position","position",-2011731912),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(500),(300)], null)], null))], null); 9 | }); 10 | pucks.worlds.dev.world2.settings = (function pucks$worlds$dev$world2$settings(){ 11 | return cljs.core.PersistentArrayMap.EMPTY; 12 | }); 13 | 14 | //# sourceMappingURL=world2.js.map 15 | -------------------------------------------------------------------------------- /src/pucks/worlds/dev/world7.cljc: -------------------------------------------------------------------------------- 1 | 2 | ;; A pucks world. 3 | 4 | (ns pucks.worlds.dev.world7 5 | (:require [pucks.agents.opener :as opener] 6 | [pucks.globals :as globals] 7 | [pucks.agents.chest :as chest] 8 | [pucks.agents.stone :as stone] 9 | [pucks.agents.vent :as vent] 10 | [pucks.agents.gate :as gate])) 11 | 12 | (defn agents [] 13 | (concat 14 | ;; walls 15 | ;; horizontal 16 | (for [x (range 500 701 20) 17 | y [300 500]] 18 | (merge (stone/stone) {:position [x y]})) 19 | ;; vertical, left (with gap for gate) 20 | (for [y (range 300 361 20)] 21 | (merge (stone/stone) {:position [500 y]})) 22 | (for [y (range 440 501 20)] 23 | (merge (stone/stone) {:position [500 y]})) 24 | ;; right 25 | (for [y (range 300 501 20)] 26 | (merge (stone/stone) {:position [700 y]})) 27 | ;; gate 28 | [(merge (gate/gate) {:position [500 400]})] 29 | ;; chest with key 30 | [(merge (chest/chest) {:position [250 430] 31 | :inventory [:key]})] 32 | ;; opener 33 | [(merge (opener/opener) {:position [100 400] 34 | :rotation globals/half-pi 35 | :velocity [1.0 0]})] 36 | ;; vent 37 | [(merge (vent/vent) {:position [600 430] 38 | :radius 30})] 39 | )) 40 | 41 | (defn settings [] 42 | {}) 43 | 44 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /src/pucks/agents/beacon.cljc: -------------------------------------------------------------------------------- 1 | ;; Definitions for beacon agents. 2 | 3 | (ns pucks.agents.beacon 4 | (:require [pucks.util :as util] 5 | [pucks.globals :as globals] 6 | [quil.core :as q] 7 | [pucks.agents.generic :as generic])) 8 | 9 | (defn draw-beacon [p] 10 | (let [[x y] (:position p) 11 | radius (:radius p) 12 | [r g b] (:color p)] 13 | (q/push-matrix) 14 | (q/translate x y) 15 | ;; membrane 16 | (q/fill r g b 32) 17 | (q/ellipse 0 0 (* radius 2) (* radius 2)) 18 | ;; core 19 | (q/ellipse 0 0 radius radius) 20 | (q/fill 0 0 0) 21 | (q/text-align :center) 22 | (q/text (str (:id p)) 0 0) 23 | (q/pop-matrix))) 24 | 25 | (defn beacon-proposals [p] 26 | {}) 27 | 28 | ;; Beacons are defined to be the maximal size compatible with the provided 29 | ;; sensor range and neighborhood size: 30 | ;; 31 | ;; beacon-radius + sensor-range = neighborhood-size 32 | ;; => beacon-radius = neighborhood-size - sensor-range 33 | 34 | (defn beacon [] 35 | (merge (generic/generic) 36 | {:beacon true 37 | :solid false 38 | :color [255 255 128] 39 | :radius (- (:neighborhood-size @globals/pucks-settings) 40 | (:sensor-range @globals/pucks-settings)) 41 | :draw-function draw-beacon 42 | :proposal-function beacon-proposals 43 | :id (gensym "beacon-") 44 | :position (util/rand-xy)})) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world7.cljc: -------------------------------------------------------------------------------- 1 | 2 | ;; A pucks world. 3 | 4 | (ns pucks.worlds.dev.world7 5 | (:require [pucks.agents.opener :as opener] 6 | [pucks.globals :as globals] 7 | [pucks.agents.chest :as chest] 8 | [pucks.agents.stone :as stone] 9 | [pucks.agents.vent :as vent] 10 | [pucks.agents.gate :as gate])) 11 | 12 | (defn agents [] 13 | (concat 14 | ;; walls 15 | ;; horizontal 16 | (for [x (range 500 701 20) 17 | y [300 500]] 18 | (merge (stone/stone) {:position [x y]})) 19 | ;; vertical, left (with gap for gate) 20 | (for [y (range 300 361 20)] 21 | (merge (stone/stone) {:position [500 y]})) 22 | (for [y (range 440 501 20)] 23 | (merge (stone/stone) {:position [500 y]})) 24 | ;; right 25 | (for [y (range 300 501 20)] 26 | (merge (stone/stone) {:position [700 y]})) 27 | ;; gate 28 | [(merge (gate/gate) {:position [500 400]})] 29 | ;; chest with key 30 | [(merge (chest/chest) {:position [250 430] 31 | :inventory [:key]})] 32 | ;; opener 33 | [(merge (opener/opener) {:position [100 400] 34 | :rotation globals/half-pi 35 | :velocity [1.0 0]})] 36 | ;; vent 37 | [(merge (vent/vent) {:position [600 430] 38 | :radius 30})] 39 | )) 40 | 41 | (defn settings [] 42 | {}) 43 | 44 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/beacon.cljc: -------------------------------------------------------------------------------- 1 | ;; Definitions for beacon agents. 2 | 3 | (ns pucks.agents.beacon 4 | (:require [pucks.util :as util] 5 | [pucks.globals :as globals] 6 | [quil.core :as q] 7 | [pucks.agents.generic :as generic])) 8 | 9 | (defn draw-beacon [p] 10 | (let [[x y] (:position p) 11 | radius (:radius p) 12 | [r g b] (:color p)] 13 | (q/push-matrix) 14 | (q/translate x y) 15 | ;; membrane 16 | (q/fill r g b 32) 17 | (q/ellipse 0 0 (* radius 2) (* radius 2)) 18 | ;; core 19 | (q/ellipse 0 0 radius radius) 20 | (q/fill 0 0 0) 21 | (q/text-align :center) 22 | (q/text (str (:id p)) 0 0) 23 | (q/pop-matrix))) 24 | 25 | (defn beacon-proposals [p] 26 | {}) 27 | 28 | ;; Beacons are defined to be the maximal size compatible with the provided 29 | ;; sensor range and neighborhood size: 30 | ;; 31 | ;; beacon-radius + sensor-range = neighborhood-size 32 | ;; => beacon-radius = neighborhood-size - sensor-range 33 | 34 | (defn beacon [] 35 | (merge (generic/generic) 36 | {:beacon true 37 | :solid false 38 | :color [255 255 128] 39 | :radius (- (:neighborhood-size @globals/pucks-settings) 40 | (:sensor-range @globals/pucks-settings)) 41 | :draw-function draw-beacon 42 | :proposal-function beacon-proposals 43 | :id (gensym "beacon-") 44 | :position (util/rand-xy)})) -------------------------------------------------------------------------------- /resources/public/js/optimized/pucks/worlds/dev/world2.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 1.10.520 {:static-fns true, :optimize-constants true} 2 | goog.provide('pucks.worlds.dev.world2'); 3 | goog.require('cljs.core'); 4 | goog.require('cljs.core.constants'); 5 | goog.require('pucks.globals'); 6 | goog.require('pucks.agents.vent'); 7 | goog.require('pucks.agents.linear'); 8 | pucks.worlds.dev.world2.agents = (function pucks$worlds$dev$world2$agents(){ 9 | return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.merge.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([pucks.agents.linear.linear(),new cljs.core.PersistentArrayMap(null, 3, [cljs.core.cst$kw$position,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(100),(300)], null),cljs.core.cst$kw$rotation,(pucks.globals.pi / (2)),cljs.core.cst$kw$velocity,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(2),(0)], null)], null)], 0)),cljs.core.merge.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([pucks.agents.vent.vent(),new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$position,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(500),(300)], null)], null)], 0))], null); 10 | }); 11 | pucks.worlds.dev.world2.settings = (function pucks$worlds$dev$world2$settings(){ 12 | return cljs.core.PersistentArrayMap.EMPTY; 13 | }); 14 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world3.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 1.10.520 {} 2 | goog.provide('pucks.worlds.dev.world3'); 3 | goog.require('cljs.core'); 4 | goog.require('pucks.agents.zigzag'); 5 | goog.require('pucks.agents.startstop'); 6 | pucks.worlds.dev.world3.agents = (function pucks$worlds$dev$world3$agents(){ 7 | return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.merge.call(null,pucks.agents.zigzag.zigzag.call(null),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"position","position",-2011731912),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(400),(400)], null),new cljs.core.Keyword(null,"velocity","velocity",-581524355),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(2),(0)], null)], null)),cljs.core.merge.call(null,pucks.agents.startstop.startstop.call(null),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"position","position",-2011731912),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(600),(400)], null),new cljs.core.Keyword(null,"velocity","velocity",-581524355),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(2),(0)], null)], null))], null); 8 | }); 9 | pucks.worlds.dev.world3.settings = (function pucks$worlds$dev$world3$settings(){ 10 | return cljs.core.PersistentArrayMap.EMPTY; 11 | }); 12 | 13 | //# sourceMappingURL=world3.js.map 14 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world3.cljc.cache.json: -------------------------------------------------------------------------------- 1 | ["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$pucks.worlds.dev.world3","~:imports",null,"~:requires",["^ ","~$zigzag","~$pucks.agents.zigzag","^:","^:","~$startstop","~$pucks.agents.startstop","^<","^<"],"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$agents",["^ ","~:protocol-inline",null,"~:meta",["^ ","~:file","/Users/jfong/projects/pucks/src/pucks/worlds/dev/world3.cljc","~:line",8,"~:column",7,"~:end-line",8,"~:end-column",13,"~:arglists",["~#list",["~$quote",["^I",[[]]]]]],"^5","~$pucks.worlds.dev.world3/agents","^C","src/pucks/worlds/dev/world3.cljc","^G",13,"~:method-params",["^I",[[]]],"~:protocol-impl",null,"~:arglists-meta",["^I",[null,null]],"^E",1,"~:variadic?",false,"^D",8,"~:ret-tag","~$cljs.core/IVector","^F",8,"~:max-fixed-arity",0,"~:fn-var",true,"^H",["^I",["^J",["^I",[[]]]]]],"~$settings",["^ ","^A",null,"^B",["^ ","^C","/Users/jfong/projects/pucks/src/pucks/worlds/dev/world3.cljc","^D",16,"^E",7,"^F",16,"^G",15,"^H",["^I",["^J",["^I",[[]]]]]],"^5","~$pucks.worlds.dev.world3/settings","^C","src/pucks/worlds/dev/world3.cljc","^G",15,"^L",["^I",[[]]],"^M",null,"^N",["^I",[null,null]],"^E",1,"^O",false,"^D",16,"^P","~$cljs.core/IMap","^F",16,"^R",0,"^S",true,"^H",["^I",["^J",["^I",[[]]]]]]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^4",["~:position","~:velocity"]],"~:order",["^[","^10"]],"~:doc",null] -------------------------------------------------------------------------------- /src/pucks/sensors.cljc: -------------------------------------------------------------------------------- 1 | ;; Sensor functions for pucks. 2 | 3 | (ns pucks.sensors 4 | (:require [pucks.globals :as globals] 5 | [pucks.vec2D :as vec2D] 6 | [pucks.util :as util])) 7 | 8 | (defn sense 9 | [p] 10 | "Sense everything in neighborhood, in the direction puck is facing, that is 11 | within sensor range." 12 | (assoc p 13 | :sensed 14 | (mapv #(-> % ;; strip features that can't be sensed 15 | (assoc :neighbors []) 16 | (assoc :overlaps []) 17 | (assoc :memory {}) 18 | (assoc :inventory [])) 19 | (filterv #(and (let [angular-difference ;; in front of me 20 | (Math/abs (- (:rotation p) 21 | (util/relative-position->rotation (:position %))))] 22 | (or (<= angular-difference globals/half-pi) 23 | (>= angular-difference (+ globals/pi globals/half-pi)))) 24 | (<= (- (vec2D/length (:position %)) (:radius %)) ;; within range 25 | (:sensor-range @globals/pucks-settings))) 26 | (:neighbors p))))) 27 | 28 | (defn run-sensors 29 | "Annotates all agents with the other agents that they can sense, as the value 30 | for the :sensed key." 31 | [] 32 | (swap! globals/all-agents 33 | (fn [objs] 34 | (util/pmapallv sense objs)))) -------------------------------------------------------------------------------- /bin/pucks/agents/vent.clj: -------------------------------------------------------------------------------- 1 | ;; Definitions for vent agents. 2 | 3 | (ns pucks.agents.vent 4 | (:use quil.core 5 | [pucks globals util vec2D] 6 | pucks.agents.generic)) 7 | 8 | (defn draw-vent [p] 9 | (let [[x y] (:position p) 10 | radius (:radius p) 11 | [r g b] (:color p) 12 | [core-r core-g core-b] [238 118 0] 13 | core-diameter (int (* (float radius) (:energy p)))] 14 | (push-matrix) 15 | (translate x y) 16 | (rotate (:rotation p)) 17 | ;; membrane 18 | (fill r g b 100) 19 | (ellipse 0 0 (* radius 2) (* radius 2)) 20 | ;; core 21 | (fill 255 255 255) 22 | (ellipse 0 0 radius radius) 23 | (fill core-r core-g core-b 196) 24 | (ellipse 0 0 core-diameter core-diameter) 25 | (pop-matrix))) 26 | 27 | ;; Give energy to any overlapping mobile agent, asking nothing in return. 28 | 29 | (defn vent-proposals [p] 30 | {:transfer (into [] (for [recipient (filter (complement :torpedo) 31 | (filter (complement :stone) 32 | (filter :mobile (:overlaps p))))] 33 | {:self (:id p) 34 | :other (:id recipient) 35 | :bid {:energy 0.01} 36 | :ask {}}))}) 37 | 38 | (defn vent [] 39 | (merge (generic) 40 | {:vent true 41 | :radius 50 42 | :draw-function draw-vent 43 | :proposal-function vent-proposals})) 44 | -------------------------------------------------------------------------------- /src/pucks/agents/vent.cljc: -------------------------------------------------------------------------------- 1 | ;; Definitions for vent agents. 2 | 3 | (ns pucks.agents.vent 4 | (:require [quil.core :as q] 5 | [pucks.agents.generic :as generic])) 6 | 7 | (defn draw-vent [p] 8 | (let [[x y] (:position p) 9 | radius (:radius p) 10 | [r g b] (:color p) 11 | [core-r core-g core-b] [238 118 0] 12 | core-diameter (int (* (float radius) (:energy p)))] 13 | (q/push-matrix) 14 | (q/translate x y) 15 | (q/rotate (:rotation p)) 16 | ;; membrane 17 | (q/fill r g b 100) 18 | (q/ellipse 0 0 (* radius 2) (* radius 2)) 19 | ;; core 20 | (q/fill 255 255 255) 21 | (q/ellipse 0 0 radius radius) 22 | (q/fill core-r core-g core-b 196) 23 | (q/ellipse 0 0 core-diameter core-diameter) 24 | (q/pop-matrix))) 25 | 26 | ;; Give energy to any overlapping mobile agent, asking nothing in return. 27 | 28 | (defn vent-proposals [p] 29 | {:transfer (into [] (for [recipient (filter (complement :torpedo) 30 | (filter (complement :stone) 31 | (filter :mobile (:overlaps p))))] 32 | {:self (:id p) 33 | :other (:id recipient) 34 | :bid {:energy 0.01} 35 | :ask {}}))}) 36 | 37 | (defn vent [] 38 | (merge (generic/generic) 39 | {:vent true 40 | :radius 50 41 | :draw-function draw-vent 42 | :proposal-function vent-proposals})) 43 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/sensors.cljc: -------------------------------------------------------------------------------- 1 | ;; Sensor functions for pucks. 2 | 3 | (ns pucks.sensors 4 | (:require [pucks.globals :as globals] 5 | [pucks.vec2D :as vec2D] 6 | [pucks.util :as util])) 7 | 8 | (defn sense 9 | [p] 10 | "Sense everything in neighborhood, in the direction puck is facing, that is 11 | within sensor range." 12 | (assoc p 13 | :sensed 14 | (mapv #(-> % ;; strip features that can't be sensed 15 | (assoc :neighbors []) 16 | (assoc :overlaps []) 17 | (assoc :memory {}) 18 | (assoc :inventory [])) 19 | (filterv #(and (let [angular-difference ;; in front of me 20 | (Math/abs (- (:rotation p) 21 | (util/relative-position->rotation (:position %))))] 22 | (or (<= angular-difference globals/half-pi) 23 | (>= angular-difference (+ globals/pi globals/half-pi)))) 24 | (<= (- (vec2D/length (:position %)) (:radius %)) ;; within range 25 | (:sensor-range @globals/pucks-settings))) 26 | (:neighbors p))))) 27 | 28 | (defn run-sensors 29 | "Annotates all agents with the other agents that they can sense, as the value 30 | for the :sensed key." 31 | [] 32 | (swap! globals/all-agents 33 | (fn [objs] 34 | (util/pmapallv sense objs)))) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world5.cljc.cache.json: -------------------------------------------------------------------------------- 1 | ["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$pucks.worlds.dev.world5","~:imports",null,"~:requires",["^ ","~$zigzag","~$pucks.agents.zigzag","^:","^:","~$startstop","~$pucks.agents.startstop","^<","^<"],"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$agents",["^ ","~:protocol-inline",null,"~:meta",["^ ","~:file","/Users/jfong/projects/pucks/src/pucks/worlds/dev/world5.cljc","~:line",7,"~:column",7,"~:end-line",7,"~:end-column",13,"~:arglists",["~#list",["~$quote",["^I",[[]]]]]],"^5","~$pucks.worlds.dev.world5/agents","^C","src/pucks/worlds/dev/world5.cljc","^G",13,"~:method-params",["^I",[[]]],"~:protocol-impl",null,"~:arglists-meta",["^I",[null,null]],"^E",1,"~:variadic?",false,"^D",7,"~:ret-tag","~$cljs.core/IVector","^F",7,"~:max-fixed-arity",0,"~:fn-var",true,"^H",["^I",["^J",["^I",[[]]]]]],"~$settings",["^ ","^A",null,"^B",["^ ","^C","/Users/jfong/projects/pucks/src/pucks/worlds/dev/world5.cljc","^D",20,"^E",7,"^F",20,"^G",15,"^H",["^I",["^J",["^I",[[]]]]]],"^5","~$pucks.worlds.dev.world5/settings","^C","src/pucks/worlds/dev/world5.cljc","^G",15,"^L",["^I",[[]]],"^M",null,"^N",["^I",[null,null]],"^E",1,"^O",false,"^D",20,"^P","~$cljs.core/IMap","^F",20,"^R",0,"^S",true,"^H",["^I",["^J",["^I",[[]]]]]]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^4",["~:cheese","~:inventory","~:position","~:velocity"]],"~:order",["^11","^12","^10","^["]],"~:doc",null] -------------------------------------------------------------------------------- /resources/public/js/optimized/pucks/worlds/dev/world3.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 1.10.520 {:static-fns true, :optimize-constants true} 2 | goog.provide('pucks.worlds.dev.world3'); 3 | goog.require('cljs.core'); 4 | goog.require('cljs.core.constants'); 5 | goog.require('pucks.agents.zigzag'); 6 | goog.require('pucks.agents.startstop'); 7 | pucks.worlds.dev.world3.agents = (function pucks$worlds$dev$world3$agents(){ 8 | return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.merge.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([pucks.agents.zigzag.zigzag(),new cljs.core.PersistentArrayMap(null, 2, [cljs.core.cst$kw$position,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(400),(400)], null),cljs.core.cst$kw$velocity,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(2),(0)], null)], null)], 0)),cljs.core.merge.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([pucks.agents.startstop.startstop(),new cljs.core.PersistentArrayMap(null, 2, [cljs.core.cst$kw$position,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(600),(400)], null),cljs.core.cst$kw$velocity,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(2),(0)], null)], null)], 0))], null); 9 | }); 10 | pucks.worlds.dev.world3.settings = (function pucks$worlds$dev$world3$settings(){ 11 | return cljs.core.PersistentArrayMap.EMPTY; 12 | }); 13 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/beacon.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/jfong\/projects\/pucks\/resources\/public\/js\/development\/pucks\/agents\/beacon.js","sources":["beacon.cljc"],"lineCount":42,"mappings":";AAEA;;;;;;AAMA,kCAAA,lCAAMA,4EAAaC;AAAnB,AACE,IAAAC,YAAY,AAAA,4FAAWD;QAAvB,AAAAE,wBAAAD,UAAA,IAAA,1CAAOG;QAAP,AAAAF,wBAAAD,UAAA,IAAA,1CAASI;IACHC,SAAO,AAAA,wFAASN;IADtBG,YAEc,AAAA,qFAAQH;QAFtB,AAAAE,wBAAAC,UAAA,IAAA,1CAEOI;QAFP,AAAAL,wBAAAC,UAAA,IAAA,1CAESK;QAFT,AAAAN,wBAAAC,UAAA,IAAA,1CAEWM;AAFX,AAGE,AAACC;;AACD,AAACC,8BAAYP,EAAEC;;AAEf,+BAAA,\/BAACO,yBAAOL,EAAEC,EAAEC;;AACZ,4BAAA,IAAA,hCAACI,oCAAc,UAAA,TAAGP,cAAU,UAAA,TAAGA;;AAE\/B,4BAAA,IAAA,hCAACO,oCAAcP,OAAOA;;AACtB,yBAAA,IAAA,IAAA,jCAACM;;AACD,+BAAA,\/BAACE;;AACD,yJAAA,IAAA,7JAACC,yBAAO,4CAAK,AAAA,gFAAKf;;AAClB,OAACgB;;AAEL,uCAAA,vCAAMC,sFAAkBjB;AAAxB,AAAA;;AASA,6BAAA,7BAAMkB;AAAN,AACE,yEAAA,2CAAA,wDAAA,KAAA,wDAAA,MAAA,uDAAA,mFAAA,MAAA,MAAA,cAAA,gYAAA,wGAAA,oHAAA,wFAAA,hkCAACC,0BAAM,AAACC,4aAIQ,CAAG,AAAA,8GAAA,AAAAC,0BAAqBC,iCACrB,AAAA,kGAAA,AAAAD,0BAAgBC,wGACZvB,+GACIkB,uFACf,2BAAA,3BAACM,oGACK,AAACC","names":["pucks.agents.beacon\/draw-beacon","p","vec__6546","cljs.core\/nth","vec__6549","x","y","radius","r","g","b","quil.core\/push-matrix","quil.core\/translate","quil.core\/fill","quil.core\/ellipse","quil.core\/text-align","quil.core\/text","quil.core\/pop-matrix","pucks.agents.beacon\/beacon-proposals","pucks.agents.beacon\/beacon","cljs.core\/merge","pucks.agents.generic\/generic","cljs.core\/deref","pucks.globals\/pucks-settings","cljs.core\/gensym","pucks.util\/rand-xy"]} -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world4.cljc.cache.json: -------------------------------------------------------------------------------- 1 | ["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$pucks.worlds.dev.world4","~:imports",null,"~:requires",["^ ","~$globals","~$pucks.globals","^:","^:","~$stone","~$pucks.agents.stone","^<","^<","~$linear","~$pucks.agents.linear","^>","^>"],"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$agents",["^ ","~:protocol-inline",null,"~:meta",["^ ","~:file","/Users/jfong/projects/pucks/src/pucks/worlds/dev/world4.cljc","~:line",8,"~:column",7,"~:end-line",8,"~:end-column",13,"~:arglists",["~#list",["~$quote",["^K",[[]]]]]],"^5","~$pucks.worlds.dev.world4/agents","^E","src/pucks/worlds/dev/world4.cljc","^I",13,"~:method-params",["^K",[[]]],"~:protocol-impl",null,"~:arglists-meta",["^K",[null,null]],"^G",1,"~:variadic?",false,"^F",8,"~:ret-tag","~$cljs.core/LazySeq","^H",8,"~:max-fixed-arity",0,"~:fn-var",true,"^J",["^K",["^L",["^K",[[]]]]]],"~$settings",["^ ","^C",null,"^D",["^ ","^E","/Users/jfong/projects/pucks/src/pucks/worlds/dev/world4.cljc","^F",18,"^G",7,"^H",18,"^I",15,"^J",["^K",["^L",["^K",[[]]]]]],"^5","~$pucks.worlds.dev.world4/settings","^E","src/pucks/worlds/dev/world4.cljc","^I",15,"^N",["^K",[[]]],"^O",null,"^P",["^K",[null,null]],"^G",1,"^Q",false,"^F",18,"^R","~$cljs.core/IMap","^H",18,"^T",0,"^U",true,"^J",["^K",["^L",["^K",[[]]]]]]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^4",["~:rotation","~:position","~:velocity"]],"~:order",["^12","^11","^13"]],"~:doc",null] -------------------------------------------------------------------------------- /bin/pucks/agents/nursery.clj: -------------------------------------------------------------------------------- 1 | ;; Definitions for nursery agents. 2 | 3 | (ns pucks.agents.nursery 4 | (:use quil.core 5 | [pucks globals util vec2D] 6 | pucks.agents.generic)) 7 | 8 | (defn draw-nursery [p] 9 | (let [[x y] (:position p) 10 | radius (:radius p) 11 | [r g b] (:color p)] 12 | (push-matrix) 13 | (translate x y) 14 | (rotate (:rotation p)) 15 | ;; membrane 16 | (fill r g b 100) 17 | (ellipse 0 0 (* radius 2) (* radius 2)) 18 | ;; core 19 | (ellipse 0 0 radius radius) 20 | (fill 32 32 32 196) 21 | (when (>= @number-of-active-agents (:nursery-threshold @pucks-settings)) 22 | (ellipse 0 0 (* 0.8 radius) (* 0.8 radius))) 23 | (pop-matrix))) 24 | 25 | (defn nursery-proposals [p] 26 | (if (and (< @number-of-active-agents (:nursery-threshold @pucks-settings)) 27 | (zero? (rand-int 50))) 28 | {:spawn [(assoc ((:spawn-function p)) 29 | ;; position will be relative to position of parent 30 | :position [(- (rand-int 3) 1) (- (rand-int 3) 1)])]} 31 | {})) 32 | 33 | ;; The nursery function, which creates a nursery agent, must be called with 34 | ;; a spawn function argument, which will be called to produce child agents. 35 | 36 | (defn nursery [spawn-function] 37 | (merge (generic) 38 | {:nursery true 39 | :radius 50 40 | :draw-function draw-nursery 41 | :color [139 0 0] 42 | :proposal-function nursery-proposals 43 | :spawn-function spawn-function})) 44 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/vent.cljc: -------------------------------------------------------------------------------- 1 | ;; Definitions for vent agents. 2 | 3 | (ns pucks.agents.vent 4 | (:require [quil.core :as q] 5 | [pucks.agents.generic :as generic])) 6 | 7 | (defn draw-vent [p] 8 | (let [[x y] (:position p) 9 | radius (:radius p) 10 | [r g b] (:color p) 11 | [core-r core-g core-b] [238 118 0] 12 | core-diameter (int (* (float radius) (:energy p)))] 13 | (q/push-matrix) 14 | (q/translate x y) 15 | (q/rotate (:rotation p)) 16 | ;; membrane 17 | (q/fill r g b 100) 18 | (q/ellipse 0 0 (* radius 2) (* radius 2)) 19 | ;; core 20 | (q/fill 255 255 255) 21 | (q/ellipse 0 0 radius radius) 22 | (q/fill core-r core-g core-b 196) 23 | (q/ellipse 0 0 core-diameter core-diameter) 24 | (q/pop-matrix))) 25 | 26 | ;; Give energy to any overlapping mobile agent, asking nothing in return. 27 | 28 | (defn vent-proposals [p] 29 | {:transfer (into [] (for [recipient (filter (complement :torpedo) 30 | (filter (complement :stone) 31 | (filter :mobile (:overlaps p))))] 32 | {:self (:id p) 33 | :other (:id recipient) 34 | :bid {:energy 0.01} 35 | :ask {}}))}) 36 | 37 | (defn vent [] 38 | (merge (generic/generic) 39 | {:vent true 40 | :radius 50 41 | :draw-function draw-vent 42 | :proposal-function vent-proposals})) 43 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world11.cljc.cache.json: -------------------------------------------------------------------------------- 1 | ["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$pucks.worlds.dev.world11","~:imports",null,"~:requires",["^ ","~$globals","~$pucks.globals","^:","^:","~$donor","~$pucks.agents.donor","^<","^<","~$linear","~$pucks.agents.linear","^>","^>"],"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$agents",["^ ","~:protocol-inline",null,"~:meta",["^ ","~:file","/Users/jfong/projects/pucks/src/pucks/worlds/dev/world11.cljc","~:line",6,"~:column",7,"~:end-line",6,"~:end-column",13,"~:arglists",["~#list",["~$quote",["^K",[[]]]]]],"^5","~$pucks.worlds.dev.world11/agents","^E","src/pucks/worlds/dev/world11.cljc","^I",13,"~:method-params",["^K",[[]]],"~:protocol-impl",null,"~:arglists-meta",["^K",[null,null]],"^G",1,"~:variadic?",false,"^F",6,"~:ret-tag","~$cljs.core/IVector","^H",6,"~:max-fixed-arity",0,"~:fn-var",true,"^J",["^K",["^L",["^K",[[]]]]]],"~$settings",["^ ","^C",null,"^D",["^ ","^E","/Users/jfong/projects/pucks/src/pucks/worlds/dev/world11.cljc","^F",14,"^G",7,"^H",14,"^I",15,"^J",["^K",["^L",["^K",[[]]]]]],"^5","~$pucks.worlds.dev.world11/settings","^E","src/pucks/worlds/dev/world11.cljc","^I",15,"^N",["^K",[[]]],"^O",null,"^P",["^K",[null,null]],"^G",1,"^Q",false,"^F",14,"^R","~$cljs.core/IMap","^H",14,"^T",0,"^U",true,"^J",["^K",["^L",["^K",[[]]]]]]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^4",["~:rotation","~:key","~:position","~:velocity"]],"~:order",["^13","^11","^14","^12"]],"~:doc",null] -------------------------------------------------------------------------------- /resources/public/js/development/goog/events/eventid.js: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | goog.provide('goog.events.EventId'); 16 | 17 | 18 | 19 | /** 20 | * A templated class that is used when registering for events. Typical usage: 21 | * 22 | * /** @type {goog.events.EventId} *\ 23 | * var myEventId = new goog.events.EventId( 24 | * goog.events.getUniqueId(('someEvent')); 25 | * 26 | * // No need to cast or declare here since the compiler knows the 27 | * // correct type of 'evt' (MyEventObj). 28 | * something.listen(myEventId, function(evt) {}); 29 | * 30 | * @param {string} eventId 31 | * @template T 32 | * @constructor 33 | * @struct 34 | * @final 35 | */ 36 | goog.events.EventId = function(eventId) { 37 | /** @const */ this.id = eventId; 38 | }; 39 | 40 | 41 | /** 42 | * @override 43 | */ 44 | goog.events.EventId.prototype.toString = function() { 45 | return this.id; 46 | }; 47 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/linear.cljc.cache.json: -------------------------------------------------------------------------------- 1 | ["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$pucks.agents.linear","~:imports",null,"~:requires",["^ ","~$util","~$pucks.util","^:","^:","~$active","~$pucks.agents.active","^<","^<"],"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$linear-proposals",["^ ","~:protocol-inline",null,"~:meta",["^ ","~:file","/Users/jfong/projects/pucks/src/pucks/agents/linear.cljc","~:line",7,"~:column",7,"~:end-line",7,"~:end-column",23,"~:arglists",["~#list",["~$quote",["^I",[["~$p"]]]]]],"^5","~$pucks.agents.linear/linear-proposals","^C","src/pucks/agents/linear.cljc","^G",23,"~:method-params",["^I",[["~$p"]]],"~:protocol-impl",null,"~:arglists-meta",["^I",[null,null]],"^E",1,"~:variadic?",false,"^D",7,"~:ret-tag","~$cljs.core/IMap","^F",7,"~:max-fixed-arity",1,"~:fn-var",true,"^H",["^I",["^J",["^I",[["~$p"]]]]]],"~$linear",["^ ","^A",null,"^B",["^ ","^C","/Users/jfong/projects/pucks/src/pucks/agents/linear.cljc","^D",11,"^E",7,"^F",11,"^G",13,"^H",["^I",["^J",["^I",[[]]]]]],"^5","~$pucks.agents.linear/linear","^C","src/pucks/agents/linear.cljc","^G",13,"^L",["^I",[[]]],"^M",null,"^N",["^I",[null,null]],"^E",1,"^O",false,"^D",11,"^P",["^4",[null,"~$any","~$clj-nil"]],"^F",11,"^R",0,"^S",true,"^H",["^I",["^J",["^I",[[]]]]]]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^4",["~:rotation","~:proposal-function","~:color","~:linear","~:acceleration","~:velocity"]],"~:order",["^14","^10","^15","^13","^11","^12"]],"~:doc",null] -------------------------------------------------------------------------------- /resources/public/js/optimized/goog/events/eventid.js: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | goog.provide('goog.events.EventId'); 16 | 17 | 18 | 19 | /** 20 | * A templated class that is used when registering for events. Typical usage: 21 | * 22 | * /** @type {goog.events.EventId} *\ 23 | * var myEventId = new goog.events.EventId( 24 | * goog.events.getUniqueId(('someEvent')); 25 | * 26 | * // No need to cast or declare here since the compiler knows the 27 | * // correct type of 'evt' (MyEventObj). 28 | * something.listen(myEventId, function(evt) {}); 29 | * 30 | * @param {string} eventId 31 | * @template T 32 | * @constructor 33 | * @struct 34 | * @final 35 | */ 36 | goog.events.EventId = function(eventId) { 37 | /** @const */ this.id = eventId; 38 | }; 39 | 40 | 41 | /** 42 | * @override 43 | */ 44 | goog.events.EventId.prototype.toString = function() { 45 | return this.id; 46 | }; 47 | -------------------------------------------------------------------------------- /resources/public/js/development/propeller/push/instructions/string.cljc.cache.json: -------------------------------------------------------------------------------- 1 | ["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ ","~$make-instruction","~$propeller.push.utils.helpers","~$def-instruction","~$propeller.push.utils.macros"],"~:excludes",["~#set",[]],"~:name","~$propeller.push.instructions.string","~:imports",null,"~:requires",["^ ","~$string","~$clojure.string","^>","^>","^4","^4","~$state","~$propeller.push.state","^@","^@"],"~:cljs.spec/speced-vars",[],"~:uses",["^ ","^3","^4"],"~:defs",["^ "],"~:cljs.spec/registry-ref",[],"~:require-macros",["^ ","^6","^6"],"~:cljs.analyzer/constants",["^ ","~:seen",["^8",["~:string_from_char","~:string_from_integer","~:string_last","~:string_conj_char","~:string_concat","~:string_drop","~:string_empty_string","~:else","~:string_replace_first","~:exec","~:string_take","~:float","~:string_replace_first_char","~:ignore-instruction","~:string_remove_char","~:string_nth","~:string_occurencesof_char","~:string_replace","~:string","~:string_iterate","~:integer","~:string_replace_char","~:string_rest","~:string_split","~:string_from_float","~:string_parse_to_chars","~:string_contains","~:string_length","~:string_substr","~:string_indexof_char","~:string_from_boolean","~:string_butlast","~:string_first","~:boolean","~:string_contains_char","~:string_set_char","~:char","~:stacks","~:string_reverse"]],"~:order",["^1;","^Z","^1A","^L","^K","^1@","^16","^1=","^1>","^M","^10","^N","^1<","^U","^1:","^H","^14","^S","^I","^19","^[","^Q","^O","^J","^17","^W","^X","^15","^V","^Y","^11","^P","^T","^12","^1B","^1?","^13","^18","^R"]],"~:doc",null] -------------------------------------------------------------------------------- /src/pucks/agents/chest.cljc: -------------------------------------------------------------------------------- 1 | ;; Definitions for chest agents. 2 | 3 | (ns pucks.agents.chest 4 | (:require 5 | [pucks.globals :as globals] 6 | [quil.core :as q] 7 | [pucks.agents.generic :as generic])) 8 | 9 | (defn draw-chest [p] 10 | (let [[x y] (:position p) 11 | radius (:radius p) 12 | [r g b] (:color p)] 13 | (q/push-matrix) 14 | (q/translate x y) 15 | (q/rotate (:rotation p)) 16 | ;; membrane 17 | (q/fill (int (+ 128 (* 128 (Math/sin (/ @globals/iteration 2))))) 18 | (int (+ 128 (* 128 (Math/sin (/ @globals/iteration 3))))) 19 | (int (+ 128 (* 128 (Math/sin (/ @globals/iteration 5))))) 20 | 100) 21 | (q/ellipse 0 0 (* radius 2) (* radius 2)) 22 | ;; core 23 | (q/fill r g b 196) 24 | (q/ellipse 0 0 radius radius) 25 | ;; inventory 26 | (when-not (empty? (:inventory p)) 27 | (q/fill 0 0 0) 28 | (q/ellipse 0 0 (* radius 0.2) (* radius 0.2))) 29 | (q/pop-matrix))) 30 | 31 | (defn chest-proposals [p] 32 | {:transfer (into [] (for [recipient (filter :mobile (:overlaps p)) 33 | item (:inventory p)] 34 | {:self (:id p) 35 | :other (:id recipient) 36 | :bid {:inventory item} 37 | :ask {:request {:inventory item}}}))}) 38 | 39 | (defn chest [] 40 | (merge (generic/generic) 41 | {:chest true 42 | :radius 30 43 | :draw-function draw-chest 44 | :proposal-function chest-proposals})) 45 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/user.cljc.cache.json: -------------------------------------------------------------------------------- 1 | ["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$pucks.agents.user","~:imports",null,"~:requires",["^ ","~$util","~$pucks.util","^:","^:","~$active","~$pucks.agents.active","^<","^<"],"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$user-proposals",["^ ","~:protocol-inline",null,"~:meta",["^ ","~:file","/Users/jfong/projects/pucks/src/pucks/agents/user.cljc","~:line",8,"~:column",7,"~:end-line",8,"~:end-column",21,"~:arglists",["~#list",["~$quote",["^I",[["~$p"]]]]]],"^5","~$pucks.agents.user/user-proposals","^C","/Users/jfong/projects/pucks/src/pucks/agents/user.cljc","^G",21,"~:method-params",["^I",[["~$p"]]],"~:protocol-impl",null,"~:arglists-meta",["^I",[null,null]],"^E",1,"~:variadic?",false,"^D",8,"~:ret-tag","~$cljs.core/IMap","^F",8,"~:max-fixed-arity",1,"~:fn-var",true,"^H",["^I",["^J",["^I",[["~$p"]]]]]],"~$user",["^ ","^A",null,"^B",["^ ","^C","/Users/jfong/projects/pucks/src/pucks/agents/user.cljc","^D",12,"^E",7,"^F",12,"^G",11,"^H",["^I",["^J",["^I",[[]]]]]],"^5","~$pucks.agents.user/user","^C","/Users/jfong/projects/pucks/src/pucks/agents/user.cljc","^G",11,"^L",["^I",[[]]],"^M",null,"^N",["^I",[null,null]],"^E",1,"^O",false,"^D",12,"^P",["^4",[null,"~$any","~$clj-nil"]],"^F",12,"^R",0,"^S",true,"^H",["^I",["^J",["^I",[[]]]]]]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^4",["~:rotation","~:proposal-function","~:acceleration","~:user","~:velocity"]],"~:order",["^12","^10","^14","^13","^11"]],"~:doc",null] -------------------------------------------------------------------------------- /resources/public/js/development/goog/dom/tags.js: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Utilities for HTML element tag names. 17 | */ 18 | goog.provide('goog.dom.tags'); 19 | 20 | goog.require('goog.object'); 21 | 22 | 23 | /** 24 | * The void elements specified by 25 | * http://www.w3.org/TR/html-markup/syntax.html#void-elements. 26 | * @const @private {!Object} 27 | */ 28 | goog.dom.tags.VOID_TAGS_ = goog.object.createSet( 29 | 'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 30 | 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'); 31 | 32 | 33 | /** 34 | * Checks whether the tag is void (with no contents allowed and no legal end 35 | * tag), for example 'br'. 36 | * @param {string} tagName The tag name in lower case. 37 | * @return {boolean} 38 | */ 39 | goog.dom.tags.isVoidTag = function(tagName) { 40 | return goog.dom.tags.VOID_TAGS_[tagName] === true; 41 | }; 42 | -------------------------------------------------------------------------------- /resources/public/js/optimized/goog/dom/tags.js: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Utilities for HTML element tag names. 17 | */ 18 | goog.provide('goog.dom.tags'); 19 | 20 | goog.require('goog.object'); 21 | 22 | 23 | /** 24 | * The void elements specified by 25 | * http://www.w3.org/TR/html-markup/syntax.html#void-elements. 26 | * @const @private {!Object} 27 | */ 28 | goog.dom.tags.VOID_TAGS_ = goog.object.createSet( 29 | 'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 30 | 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'); 31 | 32 | 33 | /** 34 | * Checks whether the tag is void (with no contents allowed and no legal end 35 | * tag), for example 'br'. 36 | * @param {string} tagName The tag name in lower case. 37 | * @return {boolean} 38 | */ 39 | goog.dom.tags.isVoidTag = function(tagName) { 40 | return goog.dom.tags.VOID_TAGS_[tagName] === true; 41 | }; 42 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/ai/world1.cljc.cache.json: -------------------------------------------------------------------------------- 1 | ["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$pucks.worlds.ai.world1","~:imports",null,"~:requires",["^ ","~$stone","~$pucks.agents.stone","^:","^:","~$user","~$pucks.agents.user","^<","^<","~$vent","~$pucks.agents.vent","^>","^>","~$zapper","~$pucks.agents.zapper","^@","^@"],"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$agents",["^ ","~:protocol-inline",null,"~:meta",["^ ","~:file","/Users/jfong/projects/pucks/src/pucks/worlds/ai/world1.cljc","~:line",9,"~:column",7,"~:end-line",9,"~:end-column",13,"~:arglists",["~#list",["~$quote",["^M",[[]]]]]],"^5","~$pucks.worlds.ai.world1/agents","^G","/Users/jfong/projects/pucks/src/pucks/worlds/ai/world1.cljc","^K",13,"~:method-params",["^M",[[]]],"~:protocol-impl",null,"~:arglists-meta",["^M",[null,null]],"^I",1,"~:variadic?",false,"^H",9,"~:ret-tag","~$cljs.core/LazySeq","^J",9,"~:max-fixed-arity",0,"~:fn-var",true,"^L",["^M",["^N",["^M",[[]]]]]],"~$settings",["^ ","^E",null,"^F",["^ ","^G","/Users/jfong/projects/pucks/src/pucks/worlds/ai/world1.cljc","^H",16,"^I",7,"^J",16,"^K",15,"^L",["^M",["^N",["^M",[[]]]]]],"^5","~$pucks.worlds.ai.world1/settings","^G","/Users/jfong/projects/pucks/src/pucks/worlds/ai/world1.cljc","^K",15,"^P",["^M",[[]]],"^Q",null,"^R",["^M",[null,null]],"^I",1,"^S",false,"^H",16,"^T","~$cljs.core/IMap","^J",16,"^V",0,"^W",true,"^L",["^M",["^N",["^M",[[]]]]]]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^4",["~:position"]],"~:order",["^13"]],"~:doc",null] -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world17.cljc.cache.json: -------------------------------------------------------------------------------- 1 | ["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$pucks.worlds.dev.world17","~:imports",null,"~:requires",["^ ","~$active","~$pucks.agents.active","^:","^:"],"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$agents",["^ ","~:protocol-inline",null,"~:meta",["^ ","~:file","/Users/jfong/projects/pucks/src/pucks/worlds/dev/world17.cljc","~:line",4,"~:column",7,"~:end-line",4,"~:end-column",13,"~:arglists",["~#list",["~$quote",["^G",[[]]]]]],"^5","~$pucks.worlds.dev.world17/agents","^A","/Users/jfong/projects/pucks/src/pucks/worlds/dev/world17.cljc","^E",13,"~:method-params",["^G",[[]]],"~:protocol-impl",null,"~:arglists-meta",["^G",[null,null]],"^C",1,"~:variadic?",false,"^B",4,"~:ret-tag","~$cljs.core/IVector","^D",4,"~:max-fixed-arity",0,"~:fn-var",true,"^F",["^G",["^H",["^G",[[]]]]]],"~$settings",["^ ","^?",null,"^@",["^ ","^A","/Users/jfong/projects/pucks/src/pucks/worlds/dev/world17.cljc","^B",23,"^C",7,"^D",23,"^E",15,"^F",["^G",["^H",["^G",[[]]]]]],"^5","~$pucks.worlds.dev.world17/settings","^A","/Users/jfong/projects/pucks/src/pucks/worlds/dev/world17.cljc","^E",15,"^J",["^G",[[]]],"^K",null,"^L",["^G",[null,null]],"^C",1,"^M",false,"^B",23,"^N","~$cljs.core/IMap","^D",23,"^P",0,"^Q",true,"^F",["^G",["^H",["^G",[[]]]]]]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^4",["~:rotation","~:proposal-function","~:thrust-angle","~:position","~:acceleration","~:velocity"]],"~:order",["^Z","^10","^Y","^12","^11","^["]],"~:doc",null] -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world2.cljc.cache.json: -------------------------------------------------------------------------------- 1 | ["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$pucks.worlds.dev.world2","~:imports",null,"~:requires",["^ ","~$globals","~$pucks.globals","^:","^:","~$vent","~$pucks.agents.vent","^<","^<","~$linear","~$pucks.agents.linear","^>","^>"],"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$agents",["^ ","~:protocol-inline",null,"~:meta",["^ ","~:file","/Users/jfong/projects/pucks/src/pucks/worlds/dev/world2.cljc","~:line",8,"~:column",7,"~:end-line",8,"~:end-column",13,"~:arglists",["~#list",["~$quote",["^K",[[]]]]]],"^5","~$pucks.worlds.dev.world2/agents","^E","/Users/jfong/projects/pucks/src/pucks/worlds/dev/world2.cljc","^I",13,"~:method-params",["^K",[[]]],"~:protocol-impl",null,"~:arglists-meta",["^K",[null,null]],"^G",1,"~:variadic?",false,"^F",8,"~:ret-tag","~$cljs.core/IVector","^H",8,"~:max-fixed-arity",0,"~:fn-var",true,"^J",["^K",["^L",["^K",[[]]]]]],"~$settings",["^ ","^C",null,"^D",["^ ","^E","/Users/jfong/projects/pucks/src/pucks/worlds/dev/world2.cljc","^F",16,"^G",7,"^H",16,"^I",15,"^J",["^K",["^L",["^K",[[]]]]]],"^5","~$pucks.worlds.dev.world2/settings","^E","/Users/jfong/projects/pucks/src/pucks/worlds/dev/world2.cljc","^I",15,"^N",["^K",[[]]],"^O",null,"^P",["^K",[null,null]],"^G",1,"^Q",false,"^F",16,"^R","~$cljs.core/IMap","^H",16,"^T",0,"^U",true,"^J",["^K",["^L",["^K",[[]]]]]]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^4",["~:rotation","~:position","~:velocity"]],"~:order",["^12","^11","^13"]],"~:doc",null] -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/chest.cljc: -------------------------------------------------------------------------------- 1 | ;; Definitions for chest agents. 2 | 3 | (ns pucks.agents.chest 4 | (:require 5 | [pucks.globals :as globals] 6 | [quil.core :as q] 7 | [pucks.agents.generic :as generic])) 8 | 9 | (defn draw-chest [p] 10 | (let [[x y] (:position p) 11 | radius (:radius p) 12 | [r g b] (:color p)] 13 | (q/push-matrix) 14 | (q/translate x y) 15 | (q/rotate (:rotation p)) 16 | ;; membrane 17 | (q/fill (int (+ 128 (* 128 (Math/sin (/ @globals/iteration 2))))) 18 | (int (+ 128 (* 128 (Math/sin (/ @globals/iteration 3))))) 19 | (int (+ 128 (* 128 (Math/sin (/ @globals/iteration 5))))) 20 | 100) 21 | (q/ellipse 0 0 (* radius 2) (* radius 2)) 22 | ;; core 23 | (q/fill r g b 196) 24 | (q/ellipse 0 0 radius radius) 25 | ;; inventory 26 | (when-not (empty? (:inventory p)) 27 | (q/fill 0 0 0) 28 | (q/ellipse 0 0 (* radius 0.2) (* radius 0.2))) 29 | (q/pop-matrix))) 30 | 31 | (defn chest-proposals [p] 32 | {:transfer (into [] (for [recipient (filter :mobile (:overlaps p)) 33 | item (:inventory p)] 34 | {:self (:id p) 35 | :other (:id recipient) 36 | :bid {:inventory item} 37 | :ask {:request {:inventory item}}}))}) 38 | 39 | (defn chest [] 40 | (merge (generic/generic) 41 | {:chest true 42 | :radius 30 43 | :draw-function draw-chest 44 | :proposal-function chest-proposals})) 45 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/shooter.cljc.cache.json: -------------------------------------------------------------------------------- 1 | ["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$pucks.agents.shooter","~:imports",null,"~:requires",["^ ","~$util","~$pucks.util","^:","^:","~$active","~$pucks.agents.active","^<","^<"],"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$shooter-proposals",["^ ","~:protocol-inline",null,"~:meta",["^ ","~:file","/Users/jfong/projects/pucks/src/pucks/agents/shooter.cljc","~:line",9,"~:column",7,"~:end-line",9,"~:end-column",24,"~:arglists",["~#list",["~$quote",["^I",[["~$p"]]]]]],"^5","~$pucks.agents.shooter/shooter-proposals","^C","src/pucks/agents/shooter.cljc","^G",24,"~:method-params",["^I",[["~$p"]]],"~:protocol-impl",null,"~:arglists-meta",["^I",[null,null]],"^E",1,"~:variadic?",false,"^D",9,"~:ret-tag","~$cljs.core/IMap","^F",9,"~:max-fixed-arity",1,"~:fn-var",true,"^H",["^I",["^J",["^I",[["~$p"]]]]]],"~$shooter",["^ ","^A",null,"^B",["^ ","^C","/Users/jfong/projects/pucks/src/pucks/agents/shooter.cljc","^D",14,"^E",7,"^F",14,"^G",14,"^H",["^I",["^J",["^I",[[]]]]]],"^5","~$pucks.agents.shooter/shooter","^C","src/pucks/agents/shooter.cljc","^G",14,"^L",["^I",[[]]],"^M",null,"^N",["^I",[null,null]],"^E",1,"^O",false,"^D",14,"^P",["^4",[null,"~$any","~$clj-nil"]],"^F",14,"^R",0,"^S",true,"^H",["^I",["^J",["^I",[[]]]]]]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^4",["~:fire-torpedo","~:rotation","~:proposal-function","~:color","~:linear","~:acceleration","~:velocity"]],"~:order",["^15","^11","^10","^16","^14","^12","^13"]],"~:doc",null] -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world18.cljc.cache.json: -------------------------------------------------------------------------------- 1 | ["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$pucks.worlds.dev.world18","~:imports",null,"~:requires",["^ ","~$swarmer","~$pucks.agents.swarmer","^:","^:","~$nursery","~$pucks.agents.nursery","^<","^<"],"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$agents",["^ ","~:protocol-inline",null,"~:meta",["^ ","~:file","/Users/jfong/projects/pucks/src/pucks/worlds/dev/world18.cljc","~:line",8,"~:column",7,"~:end-line",8,"~:end-column",13,"~:arglists",["~#list",["~$quote",["^I",[[]]]]]],"^5","~$pucks.worlds.dev.world18/agents","^C","/Users/jfong/projects/pucks/src/pucks/worlds/dev/world18.cljc","^G",13,"~:method-params",["^I",[[]]],"~:protocol-impl",null,"~:arglists-meta",["^I",[null,null]],"^E",1,"~:variadic?",false,"^D",8,"~:ret-tag","~$cljs.core/LazySeq","^F",8,"~:max-fixed-arity",0,"~:fn-var",true,"^H",["^I",["^J",["^I",[[]]]]]],"~$settings",["^ ","^A",null,"^B",["^ ","^C","/Users/jfong/projects/pucks/src/pucks/worlds/dev/world18.cljc","^D",14,"^E",7,"^F",14,"^G",15,"^H",["^I",["^J",["^I",[[]]]]]],"^5","~$pucks.worlds.dev.world18/settings","^C","/Users/jfong/projects/pucks/src/pucks/worlds/dev/world18.cljc","^G",15,"^L",["^I",[[]]],"^M",null,"^N",["^I",[null,null]],"^E",1,"^O",false,"^D",14,"^P","~$cljs.core/IMap","^F",14,"^R",0,"^S",true,"^H",["^I",["^J",["^I",[[]]]]]]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^4",["~:neighborhood-size","~:scale","~:screen-size","~:ms-limit","~:position"]],"~:order",["^13","^11","^10","^[","^12"]],"~:doc",null] -------------------------------------------------------------------------------- /resources/public/js/optimized/propeller/tools/character.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 1.10.520 {:static-fns true, :optimize-constants true} 2 | goog.provide('propeller.tools.character'); 3 | goog.require('cljs.core'); 4 | goog.require('cljs.core.constants'); 5 | /** 6 | * Gets the ASCII code of a char 7 | */ 8 | propeller.tools.character.get_ascii = (function propeller$tools$character$get_ascii(c){ 9 | return c.charCodeAt((0)); 10 | }); 11 | /** 12 | * Returns true if the given character is a letter, A-Z or a-z. 13 | */ 14 | propeller.tools.character.is_letter = (function propeller$tools$character$is_letter(c){ 15 | return (((propeller.tools.character.get_ascii("A") <= propeller.tools.character.get_ascii(c))) && ((propeller.tools.character.get_ascii(c) <= propeller.tools.character.get_ascii("z")))); 16 | }); 17 | /** 18 | * Returns true if the given character is a digit, 0-9. 19 | */ 20 | propeller.tools.character.is_digit = (function propeller$tools$character$is_digit(c){ 21 | return (((propeller.tools.character.get_ascii("0") <= propeller.tools.character.get_ascii(c))) && ((propeller.tools.character.get_ascii(c) <= propeller.tools.character.get_ascii("9")))); 22 | }); 23 | /** 24 | * Returns true if the given character is whitespace (newline, space, tab). 25 | */ 26 | propeller.tools.character.is_whitespace = (function propeller$tools$character$is_whitespace(c){ 27 | return cljs.core.contains_QMARK_(cljs.core.PersistentHashSet.createAsIfByAssoc([propeller.tools.character.get_ascii("\t"),propeller.tools.character.get_ascii(" "),propeller.tools.character.get_ascii("\n")]),propeller.tools.character.get_ascii(c)); 28 | }); 29 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/ai/world2.cljc.cache.json: -------------------------------------------------------------------------------- 1 | ["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$pucks.worlds.ai.world2","~:imports",null,"~:requires",["^ ","~$user","~$pucks.agents.user","~$globals","~$pucks.globals","~$vent","~$pucks.agents.vent","~$zapper","~$pucks.agents.zapper","~$stone","~$pucks.agents.stone","^B","^B","^>","^>","^@","^@","^:","^:","^<","^<"],"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$agents",["^ ","~:protocol-inline",null,"~:meta",["^ ","~:file","/Users/jfong/projects/pucks/src/pucks/worlds/ai/world2.cljc","~:line",10,"~:column",7,"~:end-line",10,"~:end-column",13,"~:arglists",["~#list",["~$quote",["^O",[[]]]]]],"^5","~$pucks.worlds.ai.world2/agents","^I","src/pucks/worlds/ai/world2.cljc","^M",13,"~:method-params",["^O",[[]]],"~:protocol-impl",null,"~:arglists-meta",["^O",[null,null]],"^K",1,"~:variadic?",false,"^J",10,"~:ret-tag","~$cljs.core/LazySeq","^L",10,"~:max-fixed-arity",0,"~:fn-var",true,"^N",["^O",["^P",["^O",[[]]]]]],"~$settings",["^ ","^G",null,"^H",["^ ","^I","/Users/jfong/projects/pucks/src/pucks/worlds/ai/world2.cljc","^J",19,"^K",7,"^L",19,"^M",15,"^N",["^O",["^P",["^O",[[]]]]]],"^5","~$pucks.worlds.ai.world2/settings","^I","src/pucks/worlds/ai/world2.cljc","^M",15,"^R",["^O",[[]]],"^S",null,"^T",["^O",[null,null]],"^K",1,"^U",false,"^J",19,"^V","~$cljs.core/IMap","^L",19,"^X",0,"^Y",true,"^N",["^O",["^P",["^O",[[]]]]]]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^4",["~:rotation","~:position","~:velocity"]],"~:order",["^16","^15","^17"]],"~:doc",null] -------------------------------------------------------------------------------- /bin/pucks/globals.clj: -------------------------------------------------------------------------------- 1 | ;; Global variables for pucks. 2 | 3 | (ns pucks.globals) 4 | 5 | ;; the state of the world is stored in atoms 6 | 7 | (def all-agents (atom [])) ;; all agents in the simulation 8 | 9 | (def iteration (atom 0)) ;; the number of simulation steps completed 10 | 11 | (def last-input-ms (atom 0)) ;; the time (in ms) at which the last GUI input was received 12 | 13 | (def paused (atom false)) ;; true if the simulation is paused 14 | 15 | (def number-of-active-agents (atom 0)) ;; the current number of active agents 16 | 17 | (def end-ms (atom 0)) ;; the time (in ms) at which the simulation should 18 | ;; be terminated, if (:ms-limit @pucks-settings) is non-nil 19 | 20 | ;; simulation parameters 21 | 22 | (def pucks-settings 23 | (atom {:screen-size 800 24 | :scale 1.0 25 | :neighborhood-size 200 ;; should be at least the sensor range + largest radius 26 | :sensor-range 100 27 | :single-thread-mode true 28 | :max-velocity 80 29 | :max-acceleration 1 30 | :max-rotational-velocity 0.05 31 | :collision-resolution-acceleration 100.0 32 | :cost-of-living 0.001 33 | :cost-of-collision 0.01 34 | :nursery-threshold 1000 35 | :torpedo-energy 0.1 36 | :ms-limit nil 37 | :pause-on-start nil})) 38 | 39 | ;; handy constants 40 | 41 | (def pi Math/PI) 42 | 43 | (def two-pi (* 2 Math/PI)) 44 | 45 | (def half-pi (/ Math/PI 2)) 46 | 47 | (def quarter-pi (/ Math/PI 4)) 48 | 49 | (def four-pi (* 2 two-pi)) 50 | 51 | (def minus-pi (- pi)) 52 | 53 | (def minus-two-pi (- two-pi)) 54 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/ai/world3.cljc.cache.json: -------------------------------------------------------------------------------- 1 | ["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$pucks.worlds.ai.world3","~:imports",null,"~:requires",["^ ","~$user","~$pucks.agents.user","~$pucks.agents.beacon","^;","~$vent","~$pucks.agents.vent","~$zapper","~$pucks.agents.zapper","~$beacon","^;","~$stone","~$pucks.agents.stone","^B","^B","~$nursery","~$pucks.agents.nursery","^D","^D","^=","^=","^?","^?","^:","^:"],"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$agents",["^ ","~:protocol-inline",null,"~:meta",["^ ","~:file","/Users/jfong/projects/pucks/src/pucks/worlds/ai/world3.cljc","~:line",11,"~:column",7,"~:end-line",11,"~:end-column",13,"~:arglists",["~#list",["~$quote",["^Q",[[]]]]]],"^5","~$pucks.worlds.ai.world3/agents","^K","src/pucks/worlds/ai/world3.cljc","^O",13,"~:method-params",["^Q",[[]]],"~:protocol-impl",null,"~:arglists-meta",["^Q",[null,null]],"^M",1,"~:variadic?",false,"^L",11,"~:ret-tag","~$cljs.core/LazySeq","^N",11,"~:max-fixed-arity",0,"~:fn-var",true,"^P",["^Q",["^R",["^Q",[[]]]]]],"~$settings",["^ ","^I",null,"^J",["^ ","^K","/Users/jfong/projects/pucks/src/pucks/worlds/ai/world3.cljc","^L",46,"^M",7,"^N",46,"^O",15,"^P",["^Q",["^R",["^Q",[[]]]]]],"^5","~$pucks.worlds.ai.world3/settings","^K","src/pucks/worlds/ai/world3.cljc","^O",15,"^T",["^Q",[[]]],"^U",null,"^V",["^Q",[null,null]],"^M",1,"^W",false,"^L",46,"^X","~$cljs.core/IMap","^N",46,"^Z",0,"^[",true,"^P",["^Q",["^R",["^Q",[[]]]]]]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^4",["~:id","~:position"]],"~:order",["^18","^17"]],"~:doc",null] -------------------------------------------------------------------------------- /src/pucks/agents/nursery.cljc: -------------------------------------------------------------------------------- 1 | ; Definitions for nursery agents. 2 | 3 | (ns pucks.agents.nursery 4 | (:require [pucks.globals :as globals] 5 | [quil.core :as q] 6 | [pucks.agents.generic :as generic])) 7 | 8 | 9 | 10 | (defn draw-nursery [p] 11 | (let [[x y] (:position p) 12 | radius (:radius p) 13 | [r g b] (:color p)] 14 | (q/push-matrix) 15 | (q/translate x y) 16 | (q/rotate (:rotation p)) 17 | ;; membrane 18 | (q/fill r g b 100) 19 | (q/ellipse 0 0 (* radius 2) (* radius 2)) 20 | ;; core 21 | (q/ellipse 0 0 radius radius) 22 | (q/fill 32 32 32 196) 23 | (when (>= @globals/number-of-active-agents (:nursery-threshold @globals/pucks-settings)) 24 | (q/ellipse 0 0 (* 0.8 radius) (* 0.8 radius))) 25 | (q/pop-matrix))) 26 | 27 | (defn nursery-proposals [p] 28 | (if (and (< @globals/number-of-active-agents (:nursery-threshold @globals/pucks-settings)) 29 | (zero? (rand-int 50))) 30 | {:spawn [(assoc ((:spawn-function p)) 31 | ;; position will be relative to position of parent 32 | :position [(- (rand-int 3) 1) (- (rand-int 3) 1)])]} 33 | {})) 34 | 35 | ;; The nursery function, which creates a nursery agent, must be called with 36 | ;; a spawn function argument, which will be called to produce child agents. 37 | 38 | (defn nursery [spawn-function] 39 | (merge (generic/generic) 40 | {:nursery true 41 | :radius 50 42 | :draw-function draw-nursery 43 | :color [139 0 0] 44 | :proposal-function nursery-proposals 45 | :spawn-function spawn-function})) 46 | -------------------------------------------------------------------------------- /src/pucks/worlds/dev/world6.cljc: -------------------------------------------------------------------------------- 1 | (ns pucks.worlds.dev.world6 2 | (:require [pucks.agents.zigzag :as zigzag] 3 | [pucks.agents.startstop :as startstop] 4 | [pucks.agents.nursery :as nursery] 5 | [pucks.agents.linear :as linear] 6 | [pucks.agents.stone :as stone] 7 | [pucks.agents.vent :as vent] 8 | [pucks.agents.zapper :as zapper] 9 | [pucks.agents.swarmer :as swarmer] 10 | [pucks.agents.beacon :as beacon] 11 | )) 12 | 13 | (defn agents [] 14 | (concat (for [y (take 15 (iterate #(+ % 20) 100))] 15 | (merge (stone/stone) {:position [400 y]})) 16 | (for [x (take 10 (iterate #(+ % 20) 500))] 17 | (merge (stone/stone) {:position [x 100]})) 18 | [(merge (vent/vent) {:position [600 600]}) 19 | (merge (vent/vent) {:position [700 600]}) 20 | (merge (vent/vent) {:position [650 687]}) 21 | (merge (vent/vent) {:position [550 687]}) 22 | (merge (beacon/beacon) {:position [600 400] :id 'AREA-B}) 23 | (merge (zapper/zapper) {:position [200 200]}) 24 | (merge (beacon/beacon) {:position [150 600] :id 'AREA-A}) 25 | (merge (nursery/nursery linear/linear) {:position [400 500]}) 26 | (merge (nursery/nursery swarmer/swarmer) {:position [300 650]}) 27 | (merge (nursery/nursery #(merge (startstop/startstop) {:color [0 255 255]})) {:position [600 200]}) 28 | (merge (nursery/nursery zigzag/zigzag) {:position [100 400]})] 29 | )) 30 | 31 | 32 | (defn settings [] 33 | {}) 34 | 35 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/darter.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/jfong\/projects\/pucks\/resources\/public\/js\/development\/pucks\/agents\/darter.js","sources":["darter.cljc"],"lineCount":61,"mappings":";AAGA;;;;;;;AAOA,iDAAA,jDAAMA,0GAA4BC;AAAlC,AACE,OAACC,wBAAM,CAAG,AAAA,4FAAWD,KACb,AAACE,oDAAiC,AAAA,2FAAWF;;AAEvD,uCAAA,vCAAMG,sFAAkBH;AAAxB,AACE,IAAAI,UAAM,AAAA,oFAAO,AAAA,wFAASJ;IAAtBI,cAAA,EAAA,CAAAA,mBAAAC,oBAAA,AAAAD,YAAA;AAAA,AAAA,QAAAA;KAAA;AAGa,GAAI,+DAAA,9DAAG,AAACL,yDAA2BC;AAAnC,kDAAA,8DACa,AAACE,oDAAiC,AAAA,2FAAWF;;AAD1D,kDAAA,0DAAA,2CAAA,sDAAA;;;;KAHb;AAQY,GAAI,+HAAA,9HAAG,AAACM,6BAAa,AAAA,2FAAWN;AAE9B,GAAI,+DAAA,9DAAG,AAACD,yDAA2BC;AAAnC,kDAAA,0DAAA,2CAAA,sDAAA;;AAAA,kDAAA,sEAGiB,CAAA,MAAO,4FAAA,KAAA,\/FAAI,CAAG,AAACD,yDAA2BC,KAC5B,oBAAA,nBAAGO;;;AANpC,kDAAA,sEAAA,IAAA,0DAAA,2CAAA,sDAAA,qEAAA,iFAWgC,AAACC,mCAAmB,AAACC,yBAAKC;;;;KAnBtE;AAsBgB,GAAI,0UAAA,zUAAG,AAACT,wBAAM,CAAG,AAAA,4FAAWD,KAAG,AAAA,+GAAqB,AAAA,wFAASA;AAA7D,kDAAA,8DACa,AAAA,+GAAqB,AAAA,wFAASA;;AAD3C,kDAAA,0DAAA,2CAAA,sDAAA,4DAAA,iEAAA;;;;KAtBhB;AA4BW,GAAI,8LAAA,7LAAG,AAAA,+FAAa,AAAA,wFAASA;AAA7B,kDAAA,sEAAA,KAAA,0DAAA,2CAAA,iEAEwB,8LAAA,7LAAK,AAAA,+FAAa,AAAA,wFAASA;;AAFnD,kDAAA,0DAAA,2CAAA,sDAAA;;;;;AA5BX,kDAAA,0DAAA,2CAAA,sDAAA;;;;AAmCF,6BAAA,7BAAMW;AAAN,AACE,uEAAA,2CAAA,wDAAA,KAAA,xKAACC,0BAAM,AAACC,6NAEmBV","names":["pucks.agents.darter\/rotation-velocity-mismatch","p","quil.core\/abs","pucks.util\/relative-position->rotation","pucks.agents.darter\/darter-proposals","G__6538","cljs.core\/Keyword","pucks.vec2D\/length","pucks.globals\/pi","pucks.util\/wrap-rotation","cljs.core\/rand","pucks.globals\/two-pi","pucks.agents.darter\/darter","cljs.core\/merge","pucks.agents.active\/active"]} -------------------------------------------------------------------------------- /resources/public/js/development/pucks/agents/startstop.cljc.cache.json: -------------------------------------------------------------------------------- 1 | ["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$pucks.agents.startstop","~:imports",null,"~:requires",["^ ","~$vec2D","~$pucks.vec2D","^:","^:","~$active","~$pucks.agents.active","^<","^<"],"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$startstop-proposals",["^ ","~:protocol-inline",null,"~:meta",["^ ","~:file","/Users/jfong/projects/pucks/src/pucks/agents/startstop.cljc","~:line",9,"~:column",7,"~:end-line",9,"~:end-column",26,"~:arglists",["~#list",["~$quote",["^I",[["~$p"]]]]]],"^5","~$pucks.agents.startstop/startstop-proposals","^C","/Users/jfong/projects/pucks/src/pucks/agents/startstop.cljc","^G",26,"~:method-params",["^I",[["~$p"]]],"~:protocol-impl",null,"~:arglists-meta",["^I",[null,null]],"^E",1,"~:variadic?",false,"^D",9,"~:ret-tag","~$cljs.core/IMap","^F",9,"~:max-fixed-arity",1,"~:fn-var",true,"^H",["^I",["^J",["^I",[["~$p"]]]]]],"~$startstop",["^ ","^A",null,"^B",["^ ","^C","/Users/jfong/projects/pucks/src/pucks/agents/startstop.cljc","^D",14,"^E",7,"^F",14,"^G",16,"^H",["^I",["^J",["^I",[[]]]]]],"^5","~$pucks.agents.startstop/startstop","^C","/Users/jfong/projects/pucks/src/pucks/agents/startstop.cljc","^G",16,"^L",["^I",[[]]],"^M",null,"^N",["^I",[null,null]],"^E",1,"^O",false,"^D",14,"^P",["^4",[null,"~$any","~$clj-nil"]],"^F",14,"^R",0,"^S",true,"^H",["^I",["^J",["^I",[[]]]]]]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^4",["~:proposal-function","~:color","~:steps","~:startstop","~:acceleration","~:velocity"]],"~:order",["^14","^12","^15","^13","^10","^11"]],"~:doc",null] -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world10.cljc.cache.json: -------------------------------------------------------------------------------- 1 | ["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$pucks.worlds.dev.world10","~:imports",null,"~:requires",["^ ","~$pucks.agents.beacon","^9","~$darter","~$pucks.agents.darter","~$vent","~$pucks.agents.vent","^;","^;","~$zapper","~$pucks.agents.zapper","~$beacon","^9","~$stone","~$pucks.agents.stone","^B","^B","~$nursery","~$pucks.agents.nursery","^D","^D","^=","^=","^?","^?"],"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$agents",["^ ","~:protocol-inline",null,"~:meta",["^ ","~:file","/Users/jfong/projects/pucks/src/pucks/worlds/dev/world10.cljc","~:line",12,"~:column",7,"~:end-line",12,"~:end-column",13,"~:arglists",["~#list",["~$quote",["^Q",[[]]]]]],"^5","~$pucks.worlds.dev.world10/agents","^K","src/pucks/worlds/dev/world10.cljc","^O",13,"~:method-params",["^Q",[[]]],"~:protocol-impl",null,"~:arglists-meta",["^Q",[null,null]],"^M",1,"~:variadic?",false,"^L",12,"~:ret-tag","~$cljs.core/LazySeq","^N",12,"~:max-fixed-arity",0,"~:fn-var",true,"^P",["^Q",["^R",["^Q",[[]]]]]],"~$settings",["^ ","^I",null,"^J",["^ ","^K","/Users/jfong/projects/pucks/src/pucks/worlds/dev/world10.cljc","^L",47,"^M",7,"^N",47,"^O",15,"^P",["^Q",["^R",["^Q",[[]]]]]],"^5","~$pucks.worlds.dev.world10/settings","^K","src/pucks/worlds/dev/world10.cljc","^O",15,"^T",["^Q",[[]]],"^U",null,"^V",["^Q",[null,null]],"^M",1,"^W",false,"^L",47,"^X","~$cljs.core/IMap","^N",47,"^Z",0,"^[",true,"^P",["^Q",["^R",["^Q",[[]]]]]]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^4",["~:id","~:position"]],"~:order",["^18","^17"]],"~:doc",null] -------------------------------------------------------------------------------- /project.clj: -------------------------------------------------------------------------------- 1 | (defproject pucks "0.2.0" 2 | :description "An environment for experiments and education in artificial intelligence and artificial life." 3 | :url "https://github.com/lspector/pucks" 4 | :license {:name "Eclipse Public License" 5 | :url "http://www.eclipse.org/legal/epl-v10.html"} 6 | :dependencies [[org.clojure/clojure "1.10.1"] 7 | [quil "4.0.0-SNAPSHOT"] 8 | [org.clojure/clojurescript "1.10.520"] 9 | [net.clojars.lspector/propeller "0.2.1"]] 10 | 11 | :plugins [[lein-cljsbuild "1.1.7"] 12 | [lein-figwheel "0.5.19"]] 13 | :hooks [leiningen.cljsbuild] 14 | 15 | :profiles {:uberjar {:aot :all}} 16 | :resource-paths ["target"] 17 | :main pucks.core 18 | :target-path "target/%s" 19 | 20 | :clean-targets ^{:protect false} ["resources/public/js"] 21 | :cljsbuild 22 | {:builds [; development build with figwheel hot swap 23 | {:id "development" 24 | :source-paths ["src"] 25 | :figwheel true 26 | :compiler 27 | {:main "pucks.core" 28 | :output-to "resources/public/js/main.js" 29 | :output-dir "resources/public/js/development" 30 | :asset-path "js/development"}} 31 | ; minified and bundled build for deployment 32 | {:id "optimized" 33 | :source-paths ["src"] 34 | :compiler 35 | {:main "pucks.core" 36 | :output-to "resources/public/js/main.js" 37 | :output-dir "resources/public/js/optimized" 38 | :asset-path "js/optimized" 39 | :optimizations :advanced}}]}) 40 | -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world14.cljc.cache.json: -------------------------------------------------------------------------------- 1 | ["^ ","~:rename-macros",["^ "],"~:renames",["^ "],"~:use-macros",["^ "],"~:excludes",["~#set",[]],"~:name","~$pucks.worlds.dev.world14","~:imports",null,"~:requires",["^ ","~$spawner","~$pucks.agents.spawner","^:","^:","~$nursery","~$pucks.agents.nursery","^<","^<","~$vent","~$pucks.agents.vent","^>","^>"],"~:cljs.spec/speced-vars",[],"~:uses",null,"~:defs",["^ ","~$agents",["^ ","~:protocol-inline",null,"~:meta",["^ ","~:file","/Users/jfong/projects/pucks/src/pucks/worlds/dev/world14.cljc","~:line",6,"~:column",7,"~:end-line",6,"~:end-column",13,"~:arglists",["~#list",["~$quote",["^K",[[]]]]]],"^5","~$pucks.worlds.dev.world14/agents","^E","src/pucks/worlds/dev/world14.cljc","^I",13,"~:method-params",["^K",[[]]],"~:protocol-impl",null,"~:arglists-meta",["^K",[null,null]],"^G",1,"~:variadic?",false,"^F",6,"~:ret-tag",["^4",["~$clj","~$cljs.core/IVector","~$any","~$cljs.core/MetaFn","~$clj-nil"]],"^H",6,"~:max-fixed-arity",0,"~:fn-var",true,"^J",["^K",["^L",["^K",[[]]]]]],"~$settings",["^ ","^C",null,"^D",["^ ","^E","/Users/jfong/projects/pucks/src/pucks/worlds/dev/world14.cljc","^F",13,"^G",7,"^H",13,"^I",15,"^J",["^K",["^L",["^K",[[]]]]]],"^5","~$pucks.worlds.dev.world14/settings","^E","src/pucks/worlds/dev/world14.cljc","^I",15,"^N",["^K",[[]]],"^O",null,"^P",["^K",[null,null]],"^G",1,"^Q",false,"^F",13,"^R","~$cljs.core/IMap","^H",13,"^X",0,"^Y",true,"^J",["^K",["^L",["^K",[[]]]]]]],"~:cljs.spec/registry-ref",[],"~:require-macros",null,"~:cljs.analyzer/constants",["^ ","~:seen",["^4",["~:scale","~:nursery-threshold","~:screen-size","~:single-thread-mode","~:position"]],"~:order",["^19","^17","^15","^18","^16"]],"~:doc",null] -------------------------------------------------------------------------------- /resources/public/js/development/pucks/worlds/dev/world6.cljc: -------------------------------------------------------------------------------- 1 | (ns pucks.worlds.dev.world6 2 | (:require [pucks.agents.zigzag :as zigzag] 3 | [pucks.agents.startstop :as startstop] 4 | [pucks.agents.nursery :as nursery] 5 | [pucks.agents.linear :as linear] 6 | [pucks.agents.stone :as stone] 7 | [pucks.agents.vent :as vent] 8 | [pucks.agents.zapper :as zapper] 9 | [pucks.agents.swarmer :as swarmer] 10 | [pucks.agents.beacon :as beacon] 11 | )) 12 | 13 | (defn agents [] 14 | (concat (for [y (take 15 (iterate #(+ % 20) 100))] 15 | (merge (stone/stone) {:position [400 y]})) 16 | (for [x (take 10 (iterate #(+ % 20) 500))] 17 | (merge (stone/stone) {:position [x 100]})) 18 | [(merge (vent/vent) {:position [600 600]}) 19 | (merge (vent/vent) {:position [700 600]}) 20 | (merge (vent/vent) {:position [650 687]}) 21 | (merge (vent/vent) {:position [550 687]}) 22 | (merge (beacon/beacon) {:position [600 400] :id 'AREA-B}) 23 | (merge (zapper/zapper) {:position [200 200]}) 24 | (merge (beacon/beacon) {:position [150 600] :id 'AREA-A}) 25 | (merge (nursery/nursery linear/linear) {:position [400 500]}) 26 | (merge (nursery/nursery swarmer/swarmer) {:position [300 650]}) 27 | (merge (nursery/nursery #(merge (startstop/startstop) {:color [0 255 255]})) {:position [600 200]}) 28 | (merge (nursery/nursery zigzag/zigzag) {:position [100 400]})] 29 | )) 30 | 31 | 32 | (defn settings [] 33 | {}) 34 | 35 | ;(run-pucks (agents) (settings)) -------------------------------------------------------------------------------- /resources/public/js/optimized/goog/disposable/idisposable.js: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Definition of the disposable interface. A disposable object 17 | * has a dispose method to to clean up references and resources. 18 | * @author nnaze@google.com (Nathan Naze) 19 | */ 20 | 21 | 22 | goog.provide('goog.disposable.IDisposable'); 23 | 24 | 25 | 26 | /** 27 | * Interface for a disposable object. If a instance requires cleanup 28 | * (references COM objects, DOM nodes, or other disposable objects), it should 29 | * implement this interface (it may subclass goog.Disposable). 30 | * @record 31 | */ 32 | goog.disposable.IDisposable = function() {}; 33 | 34 | 35 | /** 36 | * Disposes of the object and its resources. 37 | * @return {void} Nothing. 38 | */ 39 | goog.disposable.IDisposable.prototype.dispose = goog.abstractMethod; 40 | 41 | 42 | /** 43 | * @return {boolean} Whether the object has been disposed of. 44 | */ 45 | goog.disposable.IDisposable.prototype.isDisposed = goog.abstractMethod; 46 | --------------------------------------------------------------------------------