Add a curses front-end. This is looking good now!

And clean up some logic in `rule.py`. This is the place where the
"brains" of Copycat really live, it seems; Copycat can only succeed
at solving a puzzle if it can take the `Rule` it deduced and apply
it to the target string to produce a new string. And it can only
do that if the necessary *actions* have been programmed into `rule.py`.
Right now, it explicitly can't deal with "rules" that involve more
than one local change; that involve reversal; or more importantly,
IIUC, rules that involve "ascending runs", because the idea of a
successor-group is(?) known to the Slipnet but not to `rule.py`;
the latter deals only in "strings", not in "workspace objects".
This seems like a major flaw in the system... but maybe I'm missing
something.
This commit is contained in:
Arthur O'Dwyer
2017-04-18 20:57:24 -07:00
parent 9f8bc8e66e
commit f2ffac4e66
9 changed files with 218 additions and 52 deletions

View File

@ -14,8 +14,8 @@ J Alan Brogan writes:
> from [Melanie Mitchell](https://en.wikipedia.org/wiki/Melanie_Mitchell)'s book
> "[Analogy-Making as Perception](http://www.amazon.com/Analogy-Making-Perception-Computer-Melanie-Mitchell/dp/0262132893/ref=tmm_hrd_title_0?ie=UTF8&qid=1351269085&sr=1-3)".
Cloning the repo
----------------
Running the command-line program
--------------------------------
To clone the repo locally, run these commands:
@ -40,6 +40,25 @@ ppqqrs: 4 (avg time 439.0, avg temp 37.3)
The first number indicates how many times Copycat chose that string as its answer; higher means "more obvious".
The last number indicates the average final temperature of the workspace; lower means "more elegant".
Running the `curses` interface
------------------------------
Follow the instructions to clone the repo as above, but then run `curses_main` instead of `main`:
```
$ git clone https://github.com/Quuxplusone/co.py.cat.git
$ cd co.py.cat/copycat
$ python curses_main.py abc abd ppqqrr
```
This script takes only three arguments.
The first two are a pair of strings with some change, for example "abc" and "abd".
The third is a string which the script should try to change analogously.
The number of iterations is always implicitly "infinite".
To kill the program, hit Ctrl+C.
Installing the module
---------------------