Skip to content

Commit

Permalink
Fixed README, Added all worlds
Browse files Browse the repository at this point in the history
  • Loading branch information
jfong23 committed Oct 11, 2021
1 parent 6fa7bae commit 0ea35e9
Show file tree
Hide file tree
Showing 820 changed files with 464,068 additions and 1,445 deletions.
Binary file added .DS_Store
Binary file not shown.
29 changes: 29 additions & 0 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ The pucks transfer system is still under development and will continue to change

World files should define zero-argument functions named agents and settings. The agents function should return a sequence of agents, which will be used as the initial agents in simulations, and the settings function should return a map that maps settings keywords to desired values. Once a world file is loaded, evaluating (run-pucks (agents) (settings)) will run a simulation that starts with the agents produced by the call to agents, using the settings that result from merging the default settings with the results of the call to settings.

New worlds should be preloaded as namespaces in `core.cljs` and `core.clj` using using `:require :as`. This is due to namespaces not being able to be loaded during runtime in ClojureScript, so they must be preloaded using `:require` for both Clj and Cljs support.

## Settings

The following simulation settings are set in src/pucks/globals.clj and can be reset in world files and/or on the leiningen command line:
Expand All @@ -180,6 +182,33 @@ Setting | Description | Default
:ms-limit | the number of milliseconds that the simulation should run; if nil then it will run forever or until manually terminated; if a number then the simulation will run for that many milliseconds, print the number of iterations completed, and exit | nil
:pause-on-start | if true then the simulation will be paused immediately when started | false

## Publishing a Quil Sketch

Before you publish your sketch, run `lein do clean, cljsbuild once optimized`. This will compile your code and run Google Closure Compiler with advanced optimizations.

##Using Github Pages
Having run the Google Clojure Compiler, the files in the `resources/public` directory (index.html, style.css, js) can now be used to host the website.

If you are creating an independent repository, you will need to name the repository in the following format:`<user>.github.io` or `<organization>.github.io`.


If you are using an existing repository, you will need to make a subtree first. Since `public` will be the folder that holds pucks, we will use that as an example.


`git add public && git commit -m "Initial dist subtree commit"`

Use subtree push to send it to the `gh-pages` branch on GitHub.

`git subtree push --prefix dist origin gh-pages`

You could also copy the files and push them onto a new `gh-pages` branch using Github Desktop.

If you are creating an independent repository, you can push the files in the `resources/public` folder to your repository.

To find the link to your hosted website, go to your repository settings and look for the pages tab.
You will see a section titled `Source`, where you will be able to set the source directory for your GitHub website.
You should set your source directory to the branch where you pushed your code from `resources/public`. If you made an
independent repository, then it should be the `master` branch, or the `gh-pages` branch if you used an existing repository.

## Contributors

Expand Down
Empty file modified bin/pucks/agents/active.clj
100644 → 100755
Empty file.
Empty file modified bin/pucks/agents/beacon.clj
100644 → 100755
Empty file.
Empty file modified bin/pucks/agents/generic.clj
100644 → 100755
Empty file.
Empty file modified bin/pucks/agents/linear.clj
100644 → 100755
Empty file.
Empty file modified bin/pucks/agents/nursery.clj
100644 → 100755
Empty file.
Empty file modified bin/pucks/agents/startstop.clj
100644 → 100755
Empty file.
Empty file modified bin/pucks/agents/stone.clj
100644 → 100755
Empty file.
Empty file modified bin/pucks/agents/swarmer.clj
100644 → 100755
Empty file.
Empty file modified bin/pucks/agents/user.clj
100644 → 100755
Empty file.
Empty file modified bin/pucks/agents/vent.clj
100644 → 100755
Empty file.
Empty file modified bin/pucks/agents/zapper.clj
100644 → 100755
Empty file.
Empty file modified bin/pucks/agents/zigzag.clj
100644 → 100755
Empty file.
Empty file modified bin/pucks/core_test.clj
100644 → 100755
Empty file.
Empty file modified bin/pucks/globals.clj
100644 → 100755
Empty file.
Empty file modified bin/pucks/sensors.clj
100644 → 100755
Empty file.
Empty file modified bin/pucks/util.clj
100644 → 100755
Empty file.
Empty file modified bin/pucks/vec2D.clj
100644 → 100755
Empty file.
Empty file modified bin/pucks/worlds/ai/world1.clj
100644 → 100755
Empty file.
Empty file modified bin/pucks/worlds/dev/world1.clj
100644 → 100755
Empty file.
Empty file modified bin/pucks/worlds/dev/world2.clj
100644 → 100755
Empty file.
Empty file modified bin/pucks/worlds/dev/world3.clj
100644 → 100755
Empty file.
Empty file modified bin/pucks/worlds/dev/world4.clj
100644 → 100755
Empty file.
Empty file modified bin/pucks/worlds/dev/world5.clj
100644 → 100755
Empty file.
Empty file modified doc/intro.md
100644 → 100755
Empty file.
Empty file added figwheel_server.log
Empty file.
47 changes: 33 additions & 14 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,20 +1,39 @@
(defproject pucks "0.1.26"
:description "An environment for experiments and education in artificial intelligence and artificial life."
(defproject pucks "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "https://github.com/lspector/pucks"}
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.10.1"]
[quil "4.0.0-SNAPSHOT"]
[clojush "2.8.0"]]
[org.clojure/clojurescript "1.10.520"]
[net.clojars.lspector/propeller "0.2.1"]]

:plugins [[lein-cljsbuild "1.1.7"]
[lein-figwheel "0.5.19"]]
:hooks [leiningen.cljsbuild]

:profiles {:uberjar {:aot :all}}
:resource-paths ["target"]
:main pucks.core
:target-path "target/%s"
:profiles {:uberjar {:aot :all}}
;; the following should automatically take n% of the machine's RAM and also use the G1 garbage collector
;:jvm-opts ~(let [mem-to-use (long (* (.getTotalPhysicalMemorySize
; (java.lang.management.ManagementFactory/getOperatingSystemMXBean))
; 0.5))]
; [(str "-Xmx" mem-to-use)
; (str "-Xms" mem-to-use)
; ;"-XX:+UseG1GC"
; ])
)

:clean-targets ^{:protect false} ["resources/public/js"]
:cljsbuild
{:builds [; development build with figwheel hot swap
{:id "development"
:source-paths ["src"]
:figwheel true
:compiler
{:main "pucks.core"
:output-to "resources/public/js/main.js"
:output-dir "resources/public/js/development"
:asset-path "js/development"}}
; minified and bundled build for deployment
{:id "optimized"
:source-paths ["src"]
:compiler
{:main "pucks.core"
:output-to "resources/public/js/main.js"
:output-dir "resources/public/js/optimized"
:asset-path "js/optimized"
:optimizations :advanced}}]})
Binary file added resources/.DS_Store
Binary file not shown.
Binary file added resources/public/.DS_Store
Binary file not shown.
61 changes: 61 additions & 0 deletions resources/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<!DOCTYPE html>
<html>
<head>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Raleway:wght@600&display=swap" rel="stylesheet">
<link href='./style.css' rel='stylesheet'>
<title>pucks</title>
</head>
<body>
<p>Pucks: An environment for experiments and education in artificial intelligence and artificial life.</p>

<div align="center">

<select id="mySelect">
<option value="World1">World1</option>
<option value="World2">World2</option>
<option value="World3">World3</option>
<option value="World4">World4</option>
<option value="World5">World5</option>
<option value="World6">World6</option>
<option value="World7">World7</option>
<option value="World8">World8</option>
<option value="World9">World9</option>
<option value="World10">World10</option>
<option value="World11">World11</option>
<option value="World12">World12</option>
<option value="World13">World13</option>
<option value="World14">World14</option>
<option value="World15">World15</option>
<option value="World16">World16</option>
<option value="World17">World17</option>
<option value="World18">World18</option>
<option value="World19">World19</option>
<option value="World20">World20</option>
<option value="World21">World21</option>
<option value="World22">World22</option>
<option value="World23">World23</option>
<option value="World24">World24</option>
<option value="aiWorld1">aiWorld1</option>
<option value="aiWorld2">aiWorld2</option>
<option value="aiWorld3">aiWorld3</option>
<option value="aiWorld4">aiWorld4</option>
<option value="aiWorld5">aiWorld5</option>
<option value="aiWorld6">aiWorld6</option>
<option value="aiWorld7">aiWorld7</option>
<option value="aiWorld8">aiWorld8</option>
</select>
<button id="btn">Run!</button>

<script> document.getElementById('btn').addEventListener("click", function(){
var x = document.getElementById("mySelect").value;
pucks.core._main(x);});</script>

</div>
<div id="pucks">
<script src="js/main.js"></script>
</div>
<!-- <script>pucks.core._main()</script>-->
</body>
</html>
Loading

0 comments on commit 0ea35e9

Please sign in to comment.