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

@ -854,8 +854,9 @@ def rule_translator(ctx, codelet):
weights = __getCutoffWeights(bondDensity)
cutoff = 10.0 * random.weighted_choice(range(1, 11), weights)
if cutoff >= temperature.actual_value:
if workspace.rule.buildTranslatedRule():
workspace.foundAnswer = True
result = workspace.rule.buildTranslatedRule()
if result is not None:
workspace.finalAnswer = result
else:
temperature.clampUntil(coderack.codeletsRun + 100)