Skip to content

Instantly share code, notes, and snippets.

@lspector
lspector / vp2d.clj
Created April 10, 2014 01:48
Initial sketches toward a 2d swarm-like alife system in Clojure/Quil
;; Initial sketches toward a 2d swarm-like alife system in Clojure/Quil
;; Lee Spector, lspector@hampshire.edu, 20140409
(ns vp2d.core
(:use quil.core)
(:gen-class))
(def all-pods (atom []))
(def iteration (atom 0))
@lspector
lspector / search.clj
Last active August 29, 2015 14:07
AI search code
(ns search.core)
;; Lecture notes on AI search algorithms.
;; Lee Spector, lspector@hampshire.edu, 20141015
#_(defn is-5 [n]
(= n 5))
#_(filter is-5 [1 2 3 4 5 6 7 8 9 8 7 6 5 4 3 2 1])
@lspector
lspector / evolvefn.clj
Created October 19, 2011 02:14
Clojure code for a simple genetic programming system, for demonstration purposes.
;; Lee Spector (lspector@hampshire.edu) 20111018 - 20111113
;; 20111113 update: handles functions of different arities
(ns evolvefn
(:require [clojure.zip :as zip]))
;; This code defines and runs a genetic programming system on the problem
;; of finding a function that fits a particular set of [x y] pairs.
@lspector
lspector / evolvefn.clj
Created November 22, 2011 02:12 — forked from stonegao/evolvefn.clj
Clojure code for a simple genetic programming system, for demonstration purposes.
(ns evolvefn) ;; Lee Spector (lspector@hampshire.edu) 20111018
;; This code defines and runs a genetic programming system on the problem
;; of finding a function that fits a particular set of [x y] pairs.
;; The aim here is mostly to demonstrate how genetic programming can be
;; implemented in Clojure simply and clearly, and several things are
;; done in somewhat inefficient and/or non-standard ways. But this should
;; provide a reasonable starting point for developing more efficient/
;; standard/capable systems.
@lspector
lspector / evolvegeo.clj
Created December 9, 2011 17:27
Clojure code for a simple genetic programming system with trivial geography, for demonstration purposes.
;; Lee Spector (lspector@hampshire.edu) 20111018 - 20111121
(ns evolvegeo
(:require [clojure.zip :as zip]))
;; Like evolvefn.clj (https://gist.github.com/1335696), this this code
;; defines and runs a genetic programming system on the problem
;; of finding a function that fits a particular set of [x y] pairs.
;; Unlike evolvefn.clj, this code incorporates trivial geography
;; (http://hampshire.edu/lspector/pubs/trivial-geography-toappear.pdf).
@lspector
lspector / tag_regression.clj
Created January 17, 2012 19:42
Clojure code for tree-based genetic programming with tags (see http://hampshire.edu/lspector/tags-gecco-2011/)
;; Lee Spector (lspector@hampshire.edu) 20120106-20120117
;; Clojure code for tree-based genetic programming with tags (see http://hampshire.edu/lspector/tags-gecco-2011/)
;; REQUIRES Clojure 1.3 for the concurrency to work (set single-thread-mode to true otherwise)
(ns tag-regression
(:require [clojure.zip :as zip]))
(def single-thread-mode false)
@lspector
lspector / eval_with_tagging_with_args.clj
Created January 22, 2012 03:47
A call-limited evaluator for Lisp-style symbolic expressions with zero-argument and one-argument tag-based modules (see http://hampshire.edu/lspector/tags-gecco-2011/)
(ns eval_with_tagging_with_args)
;; A call-limited evaluator for Lisp-style symbolic expressions with zero-argument
;; and one-argument tag-based modules (see http://hampshire.edu/lspector/tags-gecco-2011/)
;; Lee Spector, lspector@hampshire.edu, 20120121
(def tagdo-semantics true)
(defn closest-association
"Returns the value for the closest match to the given tag in the given tag space, with
@lspector
lspector / GitHub-help.md
Created September 2, 2012 08:27 — forked from thelmuth/GitHub-help.md
Help file for contributors to any CI Lab project on GitHub.

General Info

  • The master branch is the stable main branch. No one should ever need to edit the master branch, and even if they do, they should definitely never push it to the Github repository. All changes to master will come as merges from other branches, which Lee will be responsible for merging with master.

  • Branches are easy and cheap to create, and should be used extensively. If you ever want to "try something out", make sure you branch from master (or some other branch) first. If you want to add a feature to a project permanently, create a branch for it while you test it, and once the bugs are ironed out, then it can be merged to master (by Lee or whoever is managing the project). If you find a bug in master, create a branch to fix it. If you want to add some code for an experiment for a paper, create a branch for it. I cannot emphasize enough: things will be easier for all of us if we always create branches for any changes to master that we need.

  • Whenever Lee updates

@lspector
lspector / lexicase.clj
Created April 6, 2012 15:39
Genetic programming with lexicase selection for modal problems. (see http://faculty.hampshire.edu/lspector/pubs/wk09p4-spector.pdf)
;; c) Lee Spector (lspector@hampshire.edu), 2012
;; Clojure code for genetic programming with lexicase selection for modal problems.
;; See http://faculty.hampshire.edu/lspector/pubs/wk09p4-spector.pdf
;; Written to run with Clojure 1.3.
(ns lexicase.core
(:require [clojure.zip :as zip]))
@lspector
lspector / evolvefn_noeval.clj
Created August 19, 2012 23:36
Clojure code for tree-based genetic programming. Like evolvefn.clj but doesn't call eval.
;; Lee Spector (lspector@hampshire.edu) 20111018 - 20120819
;; 20111113 update: handles functions of different arities
;; 20120819 update: forked this from evolvefn.clj and removed eval
(ns evolvefn_noeval
(:require [clojure.zip :as zip])
(:use [clojure.walk]))
;; This code defines and runs a genetic programming system on the problem