Skip to content
Hofstadter's copycat, more pythonically
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
copycat Remove redundant arg. Fixes #13 Aug 1, 2017
.bumpversion.cfg Set some random version number May 8, 2017
.landscape.yaml Ignore mccabe complexity smells Oct 28, 2015
.travis.yml Remove requirements from travis Apr 21, 2017
Contributors.txt Create Contributors.txt Apr 21, 2017
LICENSE Better linkage Aug 25, 2018

An implementation of Douglas Hofstadter's copycat algorithm. The copycat algorithm is explained on Wikipedia, and that page has many links for deeper reading.

This implementation is a copycat of Scott Boland's Java implementation, but re-written into Python. It's not a direct translation - but based on his code. I did not carry over the GUI, as this version can more usefully be run from command line, or imported for use by other Python scripts, and GUIs restrict the platform too much.

In cases where I could not grok the Java implementation easily I took ideas from the LISP implementation, or directly from Melanie Mitchell's "Analogy-Making as Perception"

I also tried to make the code "more pythonic".


There are no particular installation instructions, just clone and run, e.g.

$ git clone
$ cd
$ python abc abd ijk


The script takes three arguments. The first two are a pair of triplets with some change, for example "abc" and "abd". The third is a triplet which the script should try to change analogously

For example the following invocation will probably display "ijl"

$ python abc abd ijk


Readers who got this far will definitely enjoy analogising this project with @Alex-Linhares's collection of FARGonautica over yonder


A big "Thank You" for




You geeks make it all so worthwhile.


Build Status

See Also

  1. "The Copycat Project: An Experiment in Nondeterminism and Creative Analogies" by Hofstadter, Douglas
  2. "Analogy-Making as Perception" by Mitchell, Melanie
  3. The Fargonauts' "FARGonautica", a curation of analogous projects by Alex Linhares
  4. Arthur O'Dwyer (Quuxplusone on GitHub) has further cleaned and extended this code (including a GUI) in a fork available here.
You can’t perform that action at this time.