Standardised header documentation in line with current best practice.

This commit is contained in:
simon 2016-08-21 14:17:30 +01:00
parent 944b54fc89
commit f1b35dc948
7 changed files with 182 additions and 154 deletions

View file

@ -7,45 +7,49 @@
(:gen-class)) (:gen-class))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;;;
;; This program is free software; you can redistribute it and/or ;;;; mw-engine: the state/transition engine of MicroWorld.
;; modify it under the terms of the GNU General Public License ;;;;
;; as published by the Free Software Foundation; either version 2 ;;;; This program is free software; you can redistribute it and/or
;; of the License, or (at your option) any later version. ;;;; modify it under the terms of the GNU General Public License
;; ;;;; as published by the Free Software Foundation; either version 2
;; This program is distributed in the hope that it will be useful, ;;;; of the License, or (at your option) any later version.
;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;;;
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;;; This program is distributed in the hope that it will be useful,
;; GNU General Public License for more details. ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; You should have received a copy of the GNU General Public License ;;;; GNU General Public License for more details.
;; along with this program; if not, write to the Free Software ;;;;
;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ;;;; You should have received a copy of the GNU General Public License
;; USA. ;;;; along with this program; if not, write to the Free Software
;; ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
;;;; USA.
;;;;
;;;; Copyright (C) 2014 Simon Brooke
;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;;;
;; Every rule is a function of two arguments, a cell and a world. If the rule ;;;; Every rule is a function of two arguments, a cell and a world. If the rule
;; fires, it returns a new cell, which should have the same values for :x and ;;;; fires, it returns a new cell, which should have the same values for :x and
;; :y as the old cell. Anything else can be modified. ;;;; :y as the old cell. Anything else can be modified.
;; ;;;;
;; While any function of two arguments can be used as a rule, a special high ;;;; While any function of two arguments can be used as a rule, a special high
;; level rule language is provided by the `mw-parser` package, which compiles ;;;; level rule language is provided by the `mw-parser` package, which compiles
;; rules expressed in a subset of English rules into suitable functions. ;;;; rules expressed in a subset of English rules into suitable functions.
;; ;;;;
;; A cell is a map containing at least values for the keys :x, :y, and :state; ;;;; A cell is a map containing at least values for the keys :x, :y, and :state;
;; a transformation should not alter the values of :x or :y, and should not ;;;; a transformation should not alter the values of :x or :y, and should not
;; return a cell without a keyword as the value of :state. Anything else is ;;;; return a cell without a keyword as the value of :state. Anything else is
;; legal. ;;;; legal.
;; ;;;;
;; A world is a two dimensional matrix (sequence of sequences) of cells, such ;;;; A world is a two dimensional matrix (sequence of sequences) of cells, such
;; that every cell's :x and :y properties reflect its place in the matrix. ;;;; that every cell's :x and :y properties reflect its place in the matrix.
;; See `world.clj`. ;;;; See `world.clj`.
;; ;;;;
;; Each time the world is transformed (see `transform-world`, for each cell, ;;;; Each time the world is transformed (see `transform-world`, for each cell,
;; rules are applied in turn until one matches. Once one rule has matched no ;;;; rules are applied in turn until one matches. Once one rule has matched no
;; further rules can be applied. ;;;; further rules can be applied.
;; ;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn apply-rule (defn apply-rule

View file

@ -6,22 +6,26 @@
mw-engine.world)) mw-engine.world))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;;;
;; This program is free software; you can redistribute it and/or ;;;; mw-engine: the state/transition engine of MicroWorld.
;; modify it under the terms of the GNU General Public License ;;;;
;; as published by the Free Software Foundation; either version 2 ;;;; This program is free software; you can redistribute it and/or
;; of the License, or (at your option) any later version. ;;;; modify it under the terms of the GNU General Public License
;; ;;;; as published by the Free Software Foundation; either version 2
;; This program is distributed in the hope that it will be useful, ;;;; of the License, or (at your option) any later version.
;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;;;
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;;; This program is distributed in the hope that it will be useful,
;; GNU General Public License for more details. ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; You should have received a copy of the GNU General Public License ;;;; GNU General Public License for more details.
;; along with this program; if not, write to the Free Software ;;;;
;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ;;;; You should have received a copy of the GNU General Public License
;; USA. ;;;; along with this program; if not, write to the Free Software
;; ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
;;;; USA.
;;;;
;;;; Copyright (C) 2014 Simon Brooke
;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn format-css-class [state] (defn format-css-class [state]

View file

@ -10,22 +10,26 @@
map-world]])) map-world]]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;;;
;; This program is free software; you can redistribute it and/or ;;;; mw-engine: the state/transition engine of MicroWorld.
;; modify it under the terms of the GNU General Public License ;;;;
;; as published by the Free Software Foundation; either version 2 ;;;; This program is free software; you can redistribute it and/or
;; of the License, or (at your option) any later version. ;;;; modify it under the terms of the GNU General Public License
;; ;;;; as published by the Free Software Foundation; either version 2
;; This program is distributed in the hope that it will be useful, ;;;; of the License, or (at your option) any later version.
;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;;;
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;;; This program is distributed in the hope that it will be useful,
;; GNU General Public License for more details. ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; You should have received a copy of the GNU General Public License ;;;; GNU General Public License for more details.
;; along with this program; if not, write to the Free Software ;;;;
;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ;;;; You should have received a copy of the GNU General Public License
;; USA. ;;;; along with this program; if not, write to the Free Software
;; ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
;;;; USA.
;;;;
;;;; Copyright (C) 2014 Simon Brooke
;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View file

@ -9,27 +9,31 @@
[mw-engine.world :refer [make-world]])) [mw-engine.world :refer [make-world]]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;;;
;; This program is free software; you can redistribute it and/or ;;;; mw-engine: the state/transition engine of MicroWorld.
;; modify it under the terms of the GNU General Public License ;;;;
;; as published by the Free Software Foundation; either version 2 ;;;; This program is free software; you can redistribute it and/or
;; of the License, or (at your option) any later version. ;;;; modify it under the terms of the GNU General Public License
;; ;;;; as published by the Free Software Foundation; either version 2
;; This program is distributed in the hope that it will be useful, ;;;; of the License, or (at your option) any later version.
;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;;;
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;;; This program is distributed in the hope that it will be useful,
;; GNU General Public License for more details. ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; You should have received a copy of the GNU General Public License ;;;; GNU General Public License for more details.
;; along with this program; if not, write to the Free Software ;;;;
;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ;;;; You should have received a copy of the GNU General Public License
;; USA. ;;;; along with this program; if not, write to the Free Software
;; ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
;;;; USA.
;;;;
;;;; Copyright (C) 2014 Simon Brooke
;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;;;
;; Heightmaps are considered only as greyscale images, so colour is redundent (will be ;;;; Heightmaps are considered only as greyscale images, so colour is redundent
;; ignored). Darker shades are higher. ;;;; (will be ignored). Darker shades are higher.
;; ;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View file

@ -5,29 +5,33 @@
mw-engine.world)) mw-engine.world))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;;;
;; This program is free software; you can redistribute it and/or ;;;; mw-engine: the state/transition engine of MicroWorld.
;; modify it under the terms of the GNU General Public License ;;;;
;; as published by the Free Software Foundation; either version 2 ;;;; This program is free software; you can redistribute it and/or
;; of the License, or (at your option) any later version. ;;;; modify it under the terms of the GNU General Public License
;; ;;;; as published by the Free Software Foundation; either version 2
;; This program is distributed in the hope that it will be useful, ;;;; of the License, or (at your option) any later version.
;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;;;
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;;; This program is distributed in the hope that it will be useful,
;; GNU General Public License for more details. ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; You should have received a copy of the GNU General Public License ;;;; GNU General Public License for more details.
;; along with this program; if not, write to the Free Software ;;;;
;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ;;;; You should have received a copy of the GNU General Public License
;; USA. ;;;; along with this program; if not, write to the Free Software
;; ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
;;;; USA.
;;;;
;;;; Copyright (C) 2014 Simon Brooke
;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;;;
;; Since the completion of the rule language this is more or less obsolete - ;;;; Since the completion of the rule language this is more or less obsolete -
;; there are still a few things that you can do with rules written in Clojure ;;;; there are still a few things that you can do with rules written in Clojure
;; that you can't do in the rule language, but not many and I doubt they're ;;;; that you can't do in the rule language, but not many and I doubt they're
;; important. ;;;; important.
;; ;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View file

@ -6,22 +6,26 @@
[clojure.math.combinatorics :as combo])) [clojure.math.combinatorics :as combo]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;;;
;; This program is free software; you can redistribute it and/or ;;;; mw-engine: the state/transition engine of MicroWorld.
;; modify it under the terms of the GNU General Public License ;;;;
;; as published by the Free Software Foundation; either version 2 ;;;; This program is free software; you can redistribute it and/or
;; of the License, or (at your option) any later version. ;;;; modify it under the terms of the GNU General Public License
;; ;;;; as published by the Free Software Foundation; either version 2
;; This program is distributed in the hope that it will be useful, ;;;; of the License, or (at your option) any later version.
;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;;;
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;;; This program is distributed in the hope that it will be useful,
;; GNU General Public License for more details. ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; You should have received a copy of the GNU General Public License ;;;; GNU General Public License for more details.
;; along with this program; if not, write to the Free Software ;;;;
;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ;;;; You should have received a copy of the GNU General Public License
;; USA. ;;;; along with this program; if not, write to the Free Software
;; ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
;;;; USA.
;;;;
;;;; Copyright (C) 2014 Simon Brooke
;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn abs (defn abs

View file

@ -5,33 +5,37 @@
[mw-engine.utils :refer [population]])) [mw-engine.utils :refer [population]]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;;;
;; This program is free software; you can redistribute it and/or ;;;; mw-engine: the state/transition engine of MicroWorld.
;; modify it under the terms of the GNU General Public License ;;;;
;; as published by the Free Software Foundation; either version 2 ;;;; This program is free software; you can redistribute it and/or
;; of the License, or (at your option) any later version. ;;;; modify it under the terms of the GNU General Public License
;; ;;;; as published by the Free Software Foundation; either version 2
;; This program is distributed in the hope that it will be useful, ;;;; of the License, or (at your option) any later version.
;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;;;
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;;; This program is distributed in the hope that it will be useful,
;; GNU General Public License for more details. ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; You should have received a copy of the GNU General Public License ;;;; GNU General Public License for more details.
;; along with this program; if not, write to the Free Software ;;;;
;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ;;;; You should have received a copy of the GNU General Public License
;; USA. ;;;; along with this program; if not, write to the Free Software
;; ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
;;;; USA.
;;;;
;;;; Copyright (C) 2014 Simon Brooke
;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;;;
;; Functions to create and to print two dimensional cellular automata. Nothing in this ;;;; Functions to create and to print two dimensional cellular automata.
;; file should determine what states are possible within the automaton, except for the ;;;; Nothing in this namespace should determine what states are possible within
;; initial state, :new. ;;;; the automaton, except for the initial state, :new.
;; ;;;;
;; A cell is a map containing at least values for the keys :x, :y, and :state. ;;;; A cell is a map containing at least values for the keys :x, :y, and :state.
;; ;;;;
;; A world is a two dimensional matrix (sequence of sequences) of cells, such ;;;; A world is a two dimensional matrix (sequence of sequences) of cells, such
;; that every cell's :x and :y properties reflect its place in the matrix. ;;;; that every cell's :x and :y properties reflect its place in the matrix.
;; ;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;