View self-eval-music.clj
;; gorilla-repl.fileformat = 1
;; **
;;; # Self-eval music
;;;
;;; Lee Spector, 2017
;;;
;;; This is code for turning self-evaluations into music, for CS263: Artificial Intelligence at Hampshire College. The output can be played via [Klangmeister](http://ctford.github.io/klangmeister/).
;;;
;; **
View self-eval-scramble.clj
;; gorilla-repl.fileformat = 1
;; **
;;; # Self-eval scramble
;;;
;;; Lee Spector, 2017
;;;
;;; This is code for Markov chain scrambling of self-evaluations for CS263: Artificial Intelligence at Hampshire College.
;;;
;;; In this text scrambler, we start with a random word and then follow it by some word that follows that word in the original text, with the probabilities for the following words derived from the numbers of times that they follow the first word in the original text. Then we repeat the process to choose a word to follow the second word, and so on. While it's possible to do this by computing the probabilities of all word pairs in the input, we can do it more simply, and achieve the same results, with random rotations.
View ga.clj
;; gorilla-repl.fileformat = 1
;; **
;;; # A Simple Genetic Algorithm to Solve a Silly, Made-Up Problem
;;;
;;; Here we'll demonstrate the core concepts of genetic algorithms, in Clojure, by writing code to evolve a sequence of 5 integers between 1 and 100 (inclusive) that, when divided in sequence, produce 5.
;;;
;;; That is, we want numbers a, b, c, d, e such that `a / b / c / d / e = 5`
;;;
;;; It's a silly, made-up problem, but it will nonetheless allow us to see how genetic algorithms work, and how to implement them in Clojure.
View search-worksheet.clj
;; gorilla-repl.fileformat = 1
;; **
;;; # Search
;;;
;;; Lecture notes on AI search algorithms, with Clojure code.
;;;
;;; Lee Spector, lspector@hampshire.edu, 20141015-20170930
;;;
;;; Some of the code here was adapted from the [search.lisp](https://norvig.com/paip/search.lisp) Common Lisp code in Peter Norvig's Paradigms of AI Programming (1991), but with substantial modifications.
View search.clj
(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])
View vp2d.clj
;; 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))
View notes.clj
;; Minimal example of how to play a melody using Clojure/Overtone/Leipzig, based on code
;; at https://github.com/ctford/leipzig
;; by Lee Spector, lspector@hampshire.edu, 20140204
;; Add the following to your dependencies in project.cl, and do "lein deps" if your environment requires it:
;; [leipzig "0.7.0"]
(ns notes.core
(:use [leipzig melody scale live]
View GitHub-help.md

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

View evolvefn_noeval.clj
;; 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
View lexicase.clj
;; 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]))