Commit Graph

61 Commits

Author SHA1 Message Date
e17dc2aa45 Untangle some initialization code. Assert invariants. NFC. 2017-04-18 01:12:23 -07:00
fa2142efaa Replace the coderack->workspaceFormulas coupling with coderack->workspace.
This feels slightly less tangled. Still needs work.
2017-04-18 01:12:23 -07:00
63b3fd4999 Decouple Slipnode from the global slipnet. 2017-04-18 01:12:23 -07:00
10f65fcf55 Inline the constant slipnet.timeStepLength. NFC. 2017-04-18 01:12:23 -07:00
d2436601ba Decouple coderack: remove global variable coderack.
Or at least, hide it upstairs in `copycat.py`.
`copycat.py` will eventually become a class, I'm guessing,
but let's pull everything into it first.
2017-04-18 01:12:22 -07:00
f2e28c0e19 Clean some dead code in __calculateIntraStringHappiness.
Indeed, it's dead in the Java version too.
2017-04-18 01:12:22 -07:00
ae0434d910 codeletMethods.py: Replace some random.random()s with coinFlip().
There is a bugfix in here as well: one of the probabilities was
being taken the wrong way around. The result should have been to
make single-letter groups very often, I guess? Fixing this bug
doesn't show any change in Copycat's macro behavior, except that
it seems like average temperatures have gotten hotter.
2017-04-18 01:12:22 -07:00
a3b122b75c Massive overhaul of "codelet methods" and the coderack.
Should be no functional change, but this gets rid of one circular
import (some codelet methods need a pointer to the coderack, but
they should be getting that pointer from their caller, not from
the global scope) and a lot of reflection-magic.
2017-04-18 01:12:22 -07:00
f37b88d032 random.seed(42) for testing; TODO revert me 2017-04-18 01:12:22 -07:00
3d630ba389 Decouple temperature from coderack. 2017-04-18 01:12:21 -07:00
51178c049d Inline trivial function Bond.get_source(). NFC. 2017-04-18 01:12:21 -07:00
a41b639487 Remove global variable coderackPressures (bugfix?)
Before this patch, `coderackPressures.updatePressures()` was always
a no-op, as evidenced by the until-now-harmless misspelling of Python's
list `remove` operation as `removeElement`.

I can't tell if this broke anything; my tests still pass.
2017-04-18 01:12:21 -07:00
5423d078e8 Move updateTemperature() from workspaceFormulas to workspace.
And remove dead and/or logging code to simplify the logic.
2017-04-18 01:12:21 -07:00
8171b68cbe Remove some unused global variables. NFC. 2017-04-18 01:12:20 -07:00
6fcf2f3350 git rm grouprun.py 2017-04-18 01:12:20 -07:00
d60ba5277c Remove a crash-causing line in slipnet.py.
Without this patch, `python main.py abc aabbcc milk` will reliably crash.
I believe what happens here is that we initialize all the slipnodes and
everything, and then `slipnet.predecessor` becomes `None`, which means
that if that concept ever arises on its own (vs. arising as the "opposite"
of "successor"), we'll be passing around `None` instead of a proper `Slipnode`
and everything goes sideways.

This line doesn't correspond obviously to anything in the Java code,
so I think it's just bogus --- an experiment in "brain damage" that was
accidentally committed?
2017-04-18 01:07:51 -07:00
0ff9d49111 Further Pythonicity and flake8 cleanup. NFC. 2017-04-16 18:22:57 -07:00
31323cd2bc Add some end-to-end tests!
These tests are intended to protect against regressions in the high-level
behavior of Copycat. They're not super precise, and they're VERY slow.
2017-04-16 18:22:57 -07:00
8e10814802 Further Pythonicity; and remove a bunch of logging from the inner loop. 2017-04-16 01:19:36 -07:00
77bfaaf5a7 Further refactor the main harness. Print average time for each solution. 2017-04-16 00:55:18 -07:00
3103f54ada Untie some loopy logic in addCodelet. (Functional change!) 2017-04-15 23:08:12 -07:00
e094160dcd More Pythonic cleanups. NFC. 2017-04-15 23:07:28 -07:00
a2260cdaf6 Run multiple iterations. Print final temperatures. Reduce stdout spew.
This makes the output of the program more closely resemble that of the
original Copycat described in "FCCA" page 236:

> [T]he average final temperature of an answer can be thought of as
> the program's own assessment of that answer's quality, with lower
> temperatures meaning higher quality.

For example, running `python main.py abc abd ijk 100` produced the
following output:

    ijl: 98 (avg temp 16.0)
    jjk: 1 (avg temp 56.3)
    ijk: 1 (avg temp 57.9)

And for `python main.py abc abd ijkk 100`:

    ijkkk: 2 (avg temp 19.8)
    ijkl: 51 (avg temp 28.1)
    ijll: 46 (avg temp 28.9)
    djkk: 1 (avg temp 77.4)
2017-04-15 22:29:46 -07:00
ed1d95896e More Pythonic idioms in coderackPressure.py.
No functional change.
2017-04-15 22:29:46 -07:00
88ee2ddd8d Spelling: neighbour -> neighbor.
The old code mixed both spellings; we might as well be consistent.
2017-04-15 22:29:46 -07:00
5735888d02 Minor Pythonicity cleanups.
No functional change.
2017-04-14 11:37:43 -07:00
69f75c3f42 Spelling: slipability -> slippability
No functional change.
2017-04-14 11:19:25 -07:00
bcfd8a5a10 Ignore mccabe complexity smells 2015-10-28 01:34:16 +00:00
c46e3b6db0 Allow more complex functions in Landscape 2015-10-28 01:29:43 +00:00
52402b99b3 Add Landscape configuration 2015-10-28 01:25:54 +00:00
aeb8cda755 Tidy references (which were broken by daeff3d) #5 2015-06-01 10:52:20 +01:00
daeff3d9bf Pylint the code 2014-12-22 23:44:09 +00:00
a5930b486c PEP 8 - line length 2014-12-22 20:18:54 +00:00
39fb7fc9b7 outdent 2014-12-22 16:56:53 +00:00
d4bb38b858 Github calls it sh, not shell 2014-12-22 16:56:16 +00:00
98357913e9 Make a separate para of final instruction 2014-12-22 16:53:02 +00:00
0f51434191 Better linkage #4 2014-12-22 16:50:15 +00:00
c38102c02e Extend readme to explain install & run, #4 2014-12-22 16:44:51 +00:00
94a0ecae48 PEP 008, mostly lines too long 2014-12-22 16:38:10 +00:00
c0971ce029 Link to a license file actually breaks license
Namely "copyright notice and this permission notice shall be included in all copies"
2014-03-21 12:25:58 +00:00
e58e449be2 Consistent licencing across projects 2013-08-16 10:24:41 +01:00
331114ebc3 Merge pull request #3 from jtauber/master
improved PEP compliance and fixed errors preventing it from running
2012-12-10 07:59:00 -08:00
8332b1387e fixed indentation problem 2012-12-01 02:15:25 -05:00
ab27b745be fixed missing random imports 2012-12-01 02:13:31 -05:00
b939f3ec3f fixed conceptual_depth for conceptualDepth 2012-12-01 02:12:22 -05:00
2281870cf2 removed unnecessary utils 2012-12-01 02:10:33 -05:00
33cf41b585 fix linter errors and warnings 2012-12-01 02:00:03 -05:00
cfaebd150f tabs to spaces 2012-11-30 02:12:44 -05:00
1ca7f1839f proper nouns don't take articles 2012-11-30 02:03:59 -05:00
53149013cc avoid duplicitous wording 2012-11-20 21:54:15 +00:00