From 6237eab0cd0d4fd921dd5059a3e62ef2b8dfd15f Mon Sep 17 00:00:00 2001
From: simon <simon@journeyman.cc>
Date: Sat, 24 Sep 2016 10:29:34 +0100
Subject: [PATCH] 1: Preparation for conversion to CLJC. Doesn't yet fully work
 but that seems to be due to a breaking change in a library.

---
 project.clj                                         | 13 +++++++------
 .../microworld/engine}/display.clj                  |  8 ++++----
 .../core.clj => cljc/microworld/engine/core.cljc}   |  8 ++++----
 .../microworld/engine/drainage.cljc}                | 10 +++++-----
 .../microworld/engine/heightmap.cljc}               | 12 ++++++------
 .../microworld/engine/natural_rules.cljc}           |  8 ++++----
 .../utils.clj => cljc/microworld/engine/utils.cljc} |  6 +++---
 .../world.clj => cljc/microworld/engine/world.cljc} |  6 +++---
 test/{mw_engine => microworld/engine}/core_test.clj |  4 ++--
 .../engine}/drainage_test.clj                       |  8 ++++----
 .../engine}/heightmap_test.clj                      |  6 +++---
 .../{mw_engine => microworld/engine}/utils_test.clj |  6 +++---
 .../{mw_engine => microworld/engine}/world_test.clj |  4 ++--
 13 files changed, 50 insertions(+), 49 deletions(-)
 rename src/{mw_engine => clj/microworld/engine}/display.clj (92%)
 rename src/{mw_engine/core.clj => cljc/microworld/engine/core.cljc} (96%)
 rename src/{mw_engine/drainage.clj => cljc/microworld/engine/drainage.cljc} (94%)
 rename src/{mw_engine/heightmap.clj => cljc/microworld/engine/heightmap.cljc} (93%)
 rename src/{mw_engine/natural_rules.clj => cljc/microworld/engine/natural_rules.cljc} (97%)
 rename src/{mw_engine/utils.clj => cljc/microworld/engine/utils.cljc} (98%)
 rename src/{mw_engine/world.clj => cljc/microworld/engine/world.cljc} (96%)
 rename test/{mw_engine => microworld/engine}/core_test.clj (88%)
 rename test/{mw_engine => microworld/engine}/drainage_test.clj (90%)
 rename test/{mw_engine => microworld/engine}/heightmap_test.clj (93%)
 rename test/{mw_engine => microworld/engine}/utils_test.clj (98%)
 rename test/{mw_engine => microworld/engine}/world_test.clj (89%)

diff --git a/project.clj b/project.clj
index a2739ff..436a5a1 100644
--- a/project.clj
+++ b/project.clj
@@ -1,4 +1,4 @@
-(defproject mw-engine "0.1.5-SNAPSHOT"
+(defproject mw-engine "3.0.0-SNAPSHOT"
   :description "Cellular automaton world builder."
   :url "http://www.journeyman.cc/microworld/"
   :manifest {
@@ -9,13 +9,14 @@
              "Implementation-Version" "unset"
              }
   :jvm-opts ["-Xmx4g"]
+  :source-paths ["src/clj" "src/cljc"]
   :license {:name "GNU General Public License v2"
             :url "http://www.gnu.org/licenses/gpl-2.0.html"}
   :plugins [[lein-marginalia "0.7.1"]]
-  :dependencies [[org.clojure/clojure "1.6.0"]
-                 [org.clojure/math.combinatorics "0.0.7"]
+  :dependencies [[org.clojure/clojure "1.8.0"]
+                 [org.clojure/math.combinatorics "0.1.3"]
                  [org.clojure/tools.trace "0.7.8"]
-                 [org.clojure/tools.namespace "0.2.4"]
+                 [org.clojure/tools.namespace "0.2.10"]
                  [hiccup "1.0.5"]
-                 [net.mikera/imagez "0.3.1"]
-                 [fivetonine/collage "0.2.0"]])
+                 [net.mikera/imagez "0.11.0"]
+                 [fivetonine/collage "0.2.1"]])
diff --git a/src/mw_engine/display.clj b/src/clj/microworld/engine/display.clj
similarity index 92%
rename from src/mw_engine/display.clj
rename to src/clj/microworld/engine/display.clj
index 7dca8ff..c17004c 100644
--- a/src/mw_engine/display.clj
+++ b/src/clj/microworld/engine/display.clj
@@ -1,13 +1,13 @@
 (ns ^{:doc "Simple functions to allow a world to be visualised."
       :author "Simon Brooke"}
-  mw-engine.display
+  microworld.engine.display
   (:require [hiccup.core :refer [html]]
-            mw-engine.utils
-            mw-engine.world))
+            microworld.engine.utils
+            microworld.engine.world))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;
-;;;; mw-engine: the state/transition engine of MicroWorld.
+;;;; microworld.engine: the state/transition engine of MicroWorld.
 ;;;;
 ;;;; This program is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU General Public License
diff --git a/src/mw_engine/core.clj b/src/cljc/microworld/engine/core.cljc
similarity index 96%
rename from src/mw_engine/core.clj
rename to src/cljc/microworld/engine/core.cljc
index 83c1a2e..87ccd76 100644
--- a/src/mw_engine/core.clj
+++ b/src/cljc/microworld/engine/core.cljc
@@ -1,14 +1,14 @@
 (ns ^{:doc "Functions to transform a world and run rules."
       :author "Simon Brooke"}
-  mw-engine.core
+  microworld.engine.core
   (:require [clojure.core.reducers :as r]
-            [mw-engine.world :as world]
-            [mw-engine.utils :refer [get-int-or-zero map-world]])
+            [microworld.engine.world :as world]
+            [microworld.engine.utils :refer [get-int-or-zero map-world]])
   (:gen-class))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;
-;;;; mw-engine: the state/transition engine of MicroWorld.
+;;;; microworld.engine: the state/transition engine of MicroWorld.
 ;;;;
 ;;;; This program is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU General Public License
diff --git a/src/mw_engine/drainage.clj b/src/cljc/microworld/engine/drainage.cljc
similarity index 94%
rename from src/mw_engine/drainage.clj
rename to src/cljc/microworld/engine/drainage.cljc
index 87a7207..082ebc0 100644
--- a/src/mw_engine/drainage.clj
+++ b/src/cljc/microworld/engine/drainage.cljc
@@ -2,16 +2,16 @@
       compute drainage on a world, assumed to have altitudes already set
       from a heightmap."
       :author "Simon Brooke"}
-  mw-engine.drainage
-  (:require [mw-engine.core :refer [run-world]]
-            [mw-engine.heightmap :as heightmap]
-            [mw-engine.utils :refer [get-int-or-zero get-least-cell get-neighbours
+  microworld.engine.drainage
+  (:require [microworld.engine.core :refer [run-world]]
+            [microworld.engine.heightmap :as heightmap]
+            [microworld.engine.utils :refer [get-int-or-zero get-least-cell get-neighbours
                                      get-neighbours-with-property-value
                                      map-world]]))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;
-;;;; mw-engine: the state/transition engine of MicroWorld.
+;;;; microworld.engine: the state/transition engine of MicroWorld.
 ;;;;
 ;;;; This program is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU General Public License
diff --git a/src/mw_engine/heightmap.clj b/src/cljc/microworld/engine/heightmap.cljc
similarity index 93%
rename from src/mw_engine/heightmap.clj
rename to src/cljc/microworld/engine/heightmap.cljc
index cde7002..81891bf 100644
--- a/src/mw_engine/heightmap.clj
+++ b/src/cljc/microworld/engine/heightmap.cljc
@@ -1,16 +1,16 @@
 (ns ^{:doc "Functions to apply a heightmap to a world."
       :author "Simon Brooke"}
-  mw-engine.heightmap
+  microworld.engine.heightmap
   (:import [java.awt.image BufferedImage])
   (:require [fivetonine.collage.util :as collage :only [load-image]]
             [mikera.image.core :as imagez :only [filter-image get-pixels]]
             [mikera.image.filters :as filters]
-            [mw-engine.utils :refer [abs get-int get-neighbours map-world]]
-            [mw-engine.world :refer [make-world]]))
+            [microworld.engine.utils :refer [abs get-int get-neighbours map-world]]
+            [microworld.engine.world :refer [make-world]]))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;
-;;;; mw-engine: the state/transition engine of MicroWorld.
+;;;; microworld.engine: the state/transition engine of MicroWorld.
 ;;;;
 ;;;; This program is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU General Public License
@@ -42,7 +42,7 @@
    If the heightmap you supply is smaller than the world, this will break.
 
    * `world` not actually used, but present to enable this function to be
-     passed as an argument to `mw-engine.utils/map-world`, q.v.
+     passed as an argument to `microworld.engine.utils/map-world`, q.v.
    * `cell` a cell, as discussed in world.clj, q.v. Alternatively, a map;
    * `property` the property (normally a keyword) whose value will be set on the cell.
    * `heightmap` an (ideally) greyscale image, whose x and y dimensions should
@@ -86,7 +86,7 @@
    If the heightmap you supply is smaller than the world, this will break.
 
    * `world` not actually used, but present to enable this function to be
-     passed as an argument to `mw-engine.utils/map-world`, q.v.;
+     passed as an argument to `microworld.engine.utils/map-world`, q.v.;
    * `cell` a cell, as discussed in world.clj, q.v. Alternatively, a map;
    * `heightmap` an (ideally) greyscale image, whose x and y dimensions should
      exceed those of the world of which the `cell` forms part."
diff --git a/src/mw_engine/natural_rules.clj b/src/cljc/microworld/engine/natural_rules.cljc
similarity index 97%
rename from src/mw_engine/natural_rules.clj
rename to src/cljc/microworld/engine/natural_rules.cljc
index af4a124..05399b5 100644
--- a/src/mw_engine/natural_rules.clj
+++ b/src/cljc/microworld/engine/natural_rules.cljc
@@ -1,12 +1,12 @@
 (ns ^{:doc "A set of MicroWorld rules describing a simplified natural ecosystem."
        :author "Simon Brooke"}
-  mw-engine.natural-rules
-  (:require mw-engine.utils
-        mw-engine.world))
+  microworld.engine.natural-rules
+  (:require microworld.engine.utils
+        microworld.engine.world))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;
-;;;; mw-engine: the state/transition engine of MicroWorld.
+;;;; microworld.engine: the state/transition engine of MicroWorld.
 ;;;;
 ;;;; This program is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU General Public License
diff --git a/src/mw_engine/utils.clj b/src/cljc/microworld/engine/utils.cljc
similarity index 98%
rename from src/mw_engine/utils.clj
rename to src/cljc/microworld/engine/utils.cljc
index 53c359f..5f8ef9e 100644
--- a/src/mw_engine/utils.clj
+++ b/src/cljc/microworld/engine/utils.cljc
@@ -1,13 +1,13 @@
-(ns ^{:doc " Utility functions needed by MicroWorld and, specifically, in the
+(ns ^{:doc "Utility functions needed by MicroWorld and, specifically, in the
       interpretation of MicroWorld rule."
       :author "Simon Brooke"}
-  mw-engine.utils
+  microworld.engine.utils
   (:require
     [clojure.math.combinatorics :as combo]))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;
-;;;; mw-engine: the state/transition engine of MicroWorld.
+;;;; microworld.engine: the state/transition engine of MicroWorld.
 ;;;;
 ;;;; This program is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU General Public License
diff --git a/src/mw_engine/world.clj b/src/cljc/microworld/engine/world.cljc
similarity index 96%
rename from src/mw_engine/world.clj
rename to src/cljc/microworld/engine/world.cljc
index 9001ed6..aff77fb 100644
--- a/src/mw_engine/world.clj
+++ b/src/cljc/microworld/engine/world.cljc
@@ -1,12 +1,12 @@
 (ns ^{:doc "Functions to create and to print two dimensional cellular automata."
        :author "Simon Brooke"}
-  mw-engine.world
+  microworld.engine.world
 	(:require [clojure.string :as string :only [join]]
-            [mw-engine.utils :refer [population]]))
+            [microworld.engine.utils :refer [population]]))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;
-;;;; mw-engine: the state/transition engine of MicroWorld.
+;;;; microworld.engine: the state/transition engine of MicroWorld.
 ;;;;
 ;;;; This program is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU General Public License
diff --git a/test/mw_engine/core_test.clj b/test/microworld/engine/core_test.clj
similarity index 88%
rename from test/mw_engine/core_test.clj
rename to test/microworld/engine/core_test.clj
index 1491239..1d4e9cd 100644
--- a/test/mw_engine/core_test.clj
+++ b/test/microworld/engine/core_test.clj
@@ -1,6 +1,6 @@
-(ns mw-engine.core-test
+(ns microworld.engine.core-test
   (:require [clojure.test :refer :all]
-            [mw-engine.core :refer :all]))
+            [microworld.engine.core :refer :all]))
 
 (deftest apply-rule-test
   (testing "Application of a single rule"
diff --git a/test/mw_engine/drainage_test.clj b/test/microworld/engine/drainage_test.clj
similarity index 90%
rename from test/mw_engine/drainage_test.clj
rename to test/microworld/engine/drainage_test.clj
index ba2c95a..545af8c 100644
--- a/test/mw_engine/drainage_test.clj
+++ b/test/microworld/engine/drainage_test.clj
@@ -1,8 +1,8 @@
-(ns mw-engine.drainage-test
+(ns microworld.engine.drainage-test
   (:require [clojure.test :refer :all]
-            [mw-engine.world :as world]
-            [mw-engine.utils :as utils]
-            [mw-engine.drainage :refer :all]))
+            [microworld.engine.world :as world]
+            [microworld.engine.utils :as utils]
+            [microworld.engine.drainage :refer :all]))
 
 (deftest is-hollow-test
   (testing "detection of hollows"
diff --git a/test/mw_engine/heightmap_test.clj b/test/microworld/engine/heightmap_test.clj
similarity index 93%
rename from test/mw_engine/heightmap_test.clj
rename to test/microworld/engine/heightmap_test.clj
index 23f63fa..3f80776 100644
--- a/test/mw_engine/heightmap_test.clj
+++ b/test/microworld/engine/heightmap_test.clj
@@ -1,8 +1,8 @@
-(ns mw-engine.heightmap-test
+(ns microworld.engine.heightmap-test
   (:use clojure.java.io)
   (:require [clojure.test :refer :all]
-            [mw-engine.heightmap :refer :all]
-            [mw-engine.world :as world :only [make-world]]
+            [microworld.engine.heightmap :refer :all]
+            [microworld.engine.world :as world :only [make-world]]
             [clojure.math.combinatorics :as combo]))
 
 (deftest apply-heightmap-test
diff --git a/test/mw_engine/utils_test.clj b/test/microworld/engine/utils_test.clj
similarity index 98%
rename from test/mw_engine/utils_test.clj
rename to test/microworld/engine/utils_test.clj
index 0077ceb..1af5b10 100644
--- a/test/mw_engine/utils_test.clj
+++ b/test/microworld/engine/utils_test.clj
@@ -1,8 +1,8 @@
-(ns mw-engine.utils-test
-  (:use [mw-engine.world :as world])
+(ns microworld.engine.utils-test
+  (:use [microworld.engine.world :as world])
   (:require [clojure.test :refer :all]
             [clojure.math.combinatorics :as combo]
-            [mw-engine.utils :refer :all]))
+            [microworld.engine.utils :refer :all]))
 
 (deftest abs-test 
   (testing "Absolute value function"
diff --git a/test/mw_engine/world_test.clj b/test/microworld/engine/world_test.clj
similarity index 89%
rename from test/mw_engine/world_test.clj
rename to test/microworld/engine/world_test.clj
index 7d50a3b..e6d011d 100644
--- a/test/mw_engine/world_test.clj
+++ b/test/microworld/engine/world_test.clj
@@ -1,6 +1,6 @@
-(ns mw-engine.world-test
+(ns microworld.engine.world-test
   (:require [clojure.test :refer :all]
-            [mw-engine.world :refer :all]
+            [microworld.engine.world :refer :all]
             [clojure.math.combinatorics :as combo]))
 
 (deftest genesis-test