This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; gorilla-repl.fileformat = 1 | |
;; ** | |
;;; # Gaussian | |
;; ** | |
;; @@ | |
(ns gaussian | |
(:require [gorilla-plot.core :as plot])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn maria | |
[] | |
(+ 1 3)) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; gorilla-repl.fileformat = 1 | |
;; ** | |
;;; # Palindrome | |
;;; | |
;;; Lee Spector, [email protected], 20180213 | |
;;; | |
;;; Here's another simple genetic algorithm demonstration, this one for evolving a palindrome -- a word that's the same backwards as forwards. | |
;;; | |
;;; We could represent words as strings of characters, but some things are a little simpler to do with vectors, so here we'll represent words as vectors of single-letter symbols. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; gorilla-repl.fileformat = 1 | |
;; ** | |
;;; # Primes | |
;; ** | |
;; @@ | |
(ns primes) | |
;; @@ | |
;; => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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/). | |
;;; | |
;; ** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; gorilla-repl.fileformat = 1 | |
;; ** | |
;;; # Search | |
;;; | |
;;; Lecture notes on AI search algorithms, with Clojure code. | |
;;; | |
;;; Lee Spector, [email protected], 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns search.core) | |
;; Lecture notes on AI search algorithms. | |
;; Lee Spector, [email protected], 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]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Initial sketches toward a 2d swarm-like alife system in Clojure/Quil | |
;; Lee Spector, [email protected], 20140409 | |
(ns vp2d.core | |
(:use quil.core) | |
(:gen-class)) | |
(def all-pods (atom [])) | |
(def iteration (atom 0)) |
NewerOlder