Skip to content

Instantly share code, notes, and snippets.

Richard Hull rm-hull

Block or report user

Report or block rm-hull

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rm-hull
rm-hull / 10-print.cljs
Last active Aug 29, 2015
_10 PRINT_ is a book about a one-line Commodore 64 BASIC program, published in November 2012. To paraphrase from http://10print.org/ _"... a single line of code—the extremely concise BASIC program for the Commodore 64 inscribed in the title—and uses it as a lens through which to consider the phenomenon of creative computing and the way computer…
View 10-print.cljs
; 10 PRINT CHR$(205.5+RND(1)); : GOTO 10
(ns big-bang.examples.ten-print
(:require
[jayq.core :refer [show]]
[inkspot.color-chart :as cc]
[big-bang.core :refer [big-bang]]
[big-bang.events.browser :refer [client-coords]]
[enchilada :refer [ctx canvas canvas-size value-of]]
[monet.canvas :refer [begin-path move-to line-to
@rm-hull
rm-hull / collatz-orbit.cljs
Last active Aug 29, 2015
A force-directed graph (using _arbor.js_) showing the orbits of small numbers under the Collatz map. Lothar Collatz first proposed the following conjecture in 1937: Take any natural number $n$. If $n$ is even, divide it by 2 to get $n / 2$. If $n$ is odd, multiply it by 3 and add 1 to obtain $3n + 1$. Repeat the process indefinitely. The conject…
View collatz-orbit.cljs
(ns arbor-demo.collatz-orbit
(:require
[arbor :as arbor]
[jayq.core :refer [show]]
[enchilada :refer [ctx canvas value-of]]
[monet.canvas :refer [begin-path move-to line-to save translate rotate restore
fill-style fill fill-rect circle text text-align text-baseline
stroke-style stroke-width stroke]]))
(defn draw-edge! [edge pt1 pt2]
@rm-hull
rm-hull / nks1.cljs
Last active Aug 29, 2015
Stephen Wolfram announced a class of a one-dimensional binary cellular automaton rules in 1983 and published further analysis in his 2002 book _A New Kind of Science_. The most famous instance is "Rule 30": a Class III rule, displaying aperiodic, chaotic behaviour. This rule is of particular interest because it produces complex, seemingly random…
View nks1.cljs
(ns big-bang.examples.nks1
(:require
[jayq.core :refer [show]]
[inkspot.color-chart :as cc]
[big-bang.core :refer [big-bang]]
[enchilada :refer [ctx canvas canvas-size value-of]]
[monet.canvas :refer [clear-rect fill-rect fill-style draw-image]]
[dommy.core :refer [insert-after! set-text!]])
(:require-macros
[dommy.macros :refer [sel1 node]]))
@rm-hull
rm-hull / SUTCLIFFE-PENTAGON.md
Last active Aug 29, 2015
If you draw a pentagon, then plot the midpoints of each of its five sides and extend a line perpendicular to each of these points, you can connect the end of these lines to make another pentagon. In doing this, the remaining area of the shape also ends up being subdivided into further pentagons, meaning that within each pentagon are six subpenta…
View SUTCLIFFE-PENTAGON.md

Matt Peason, author of Generative Art say in his book (ch.8):

In 2008 I went to a meeting of the Computer Arts Society (CAS) in London, an organization that was (remarkably, for a body devoted to computing) celebrating its fortieth anniversary with that event. There, I heard a short talk by the society’s initiator and first chairman, the artist and mathematician Alan Sutcliffe. Through this talk, he introduced me to a marvellous shape, which I have since mentally dubbed the Sutcliffe Pentagon.

To be clear, I’ve spoken to Alan about this, and he isn’t entirely over the

@rm-hull
rm-hull / interpolator.cljs
Created Sep 20, 2014
A polyline interpolator, implemented in a CSP style: two _big-bang_'s interact - the 'generator' sends pairs of polylines to an 'interpolator' which is responsible for smooth rendering the transitions between the _from_ and _to_ states. The code here will form the basis of future gists: (i) to visualise solving the travelling salesman problem (u…
View interpolator.cljs
(ns big-bang.examples.interpolator
(:require
[cljs.core.async :as async]
[enchilada :refer [canvas ctx canvas-size]]
[big-bang.core :refer [big-bang]]
[big-bang.package :refer [make-package]]
[jayq.core :refer [show]]
[monet.canvas :refer [clear-rect fill-style fill fill-rect circle
stroke-style stroke-width stroke-join stroke
begin-path move-to line-to]]))
@rm-hull
rm-hull / bézier-numbers.cljs
Last active Aug 29, 2015
A subtle variation of Jack Frigaard's _Bézier Clock_ implemented in ClojureScript. Rather than just rendering the current time, this separates the value generation from interpolating the Bézier control points that go up to make the digits using communicating sequential processes, as supplied by _Big-bang_ and _core.async_ channels. The generator…
View bézier-numbers.cljs
(ns enchilada.bezier-numbers
(:require
[jayq.core :refer [show]]
[cljs.core.async :as async]
[dommy.core :refer [insert-after! set-attr! show!]]
[big-bang.core :refer [big-bang]]
[big-bang.components :refer [dropdown]]
[enchilada :refer [canvas ctx canvas-size value-of]]
[enchilada.bezier-numbers.lerp :as lerp]
[enchilada.bezier-numbers.generator :as gen])
@rm-hull
rm-hull / hilbert-curve.cljs
Last active Aug 29, 2015
A Hilbert space-filling curve is a fractal first discovered by German mathematician David Hilbert in 1891. It is commonly used in mapping applications because they give a mapping between 1D and 2D space that fairly well preserves locality. Michelle Brush gave an excellent talk at Strangeloop 2014 entitled _Practical Fractals in Space_ (https://w…
View hilbert-curve.cljs
(ns enchilada.hilbert-curve
(:require
[big-bang.core :refer [big-bang]]
[big-bang.events.browser :refer [offset-coords]]
[jayq.core :refer [show attr css]]
[enchilada :refer [ctx canvas]]
[inkspot.color-chart :as color-chart]
[monet.canvas :refer [begin-path move-to line-to
fill-rect fill-style
clear-rect stroke stroke-style stroke-width
@rm-hull
rm-hull / travelling-salesman.cljs
Last active Aug 29, 2015
The TSP ('travelling salesman problem') is a popular demonstration of an NP-hard problem in Computer Science: Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city exactly once and returns to the origin city? This implementation uses an evolutionary _cumulative-selection_ …
View travelling-salesman.cljs
(ns enchilada.travelling-salesman
(:require
[cljs.core.async :as async]
[enchilada :refer [canvas ctx canvas-size]]
[enchilada.travelling-salesman.datasets :as data]
[big-bang.core :refer [big-bang]]
[big-bang.package :refer [make-package]]
[jayq.core :refer [show]]
[monet.canvas :refer [clear-rect fill-style fill fill-rect circle
stroke-style stroke-width stroke-join stroke
@rm-hull
rm-hull / four-bugs.cljs
Last active Aug 29, 2015
Although this gist is not exactly the four bug problem (where bugs/mice/insects are placed at the corners of a regular polygon, and each bug then begins to move towards its immediate neighbour in an counter-clockwise direction), it started out with that intention. Instead, because the angles are quite shallow and the lines close together, an int…
View four-bugs.cljs
(ns enchilada.four-bugs
(:require
[jayq.core :refer [show]]
[big-bang.core :refer [big-bang]]
[enchilada :refer [canvas ctx value-of]]
[monet.canvas :refer [translate scale rotate
save restore fill-rect
stroke-style stroke fill-style fill
begin-path close-path move-to line-to]]))
You can’t perform that action at this time.