7yl4r / LifeGenes

:jeans: genetic inheritance + Conway's Game of Life.
12 stars 1 forks source link

Directory structure broken #24

Closed nhpackard closed 6 years ago

nhpackard commented 6 years ago

Hi. Interesting project. Anyone still looking at it?

I tried to execute the scripts, and found I could not. Typical error was

module LifeGenes.lifegenes_core.environment not found

Seemed like most expedient solution, given the way the code is written, was to create a directory LifeGenes on the same level as the python scripts (e.g. evolveMovingCells.py that I was trying to load), and then move lifegenes_core.environment into it.

In addition, I had to add "." to sys.path to see the LifeGenes module (directory).

All this is now in a local branch of mine called restructure.

Then the modules load, but I get various other errors, e.g.:

Exception RuntimeError: 'State value is out of range.' in <bound method environment.__del__ of <LifeGenes.lifegenes_core.environment.environment instance at 0x10c13e3f8>> ignored
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/n/Projects/LifeGenes/golly/Scripts/Python/LifeGenes/evolveMovingCells.py", line 59, in <module>
    run()
  File "/Users/n/Projects/LifeGenes/golly/Scripts/Python/LifeGenes/evolveMovingCells.py", line 24, in __init__
    lg_envmt = lifegenes_environment()
  File "./LifeGenes/lifegenes_core/environment.py", line 40, in __init__
    self.cellList.load(self.CELL_LIST_FILENAME)
  File "./LifeGenes/lifegenes_core/cellList.py", line 57, in load
    with open(fname,'rb') as f:
IOError: [Errno 2] No such file or directory: '/Users/n/Library/Application Support/LifeGenes/lifeGenes_cellList.pk'

But this is not consistent; I get other errors (e.g. 'constant' is not an acceptable cell state specification') on other tries.

I thought I would see about the structural issues before digging into the others.

If you add me to the repo (nhpackard), I will push my restructure branch up for you to take a look.

7yl4r commented 6 years ago

I haven't looked at this in quite some time, and I'm sorry I didn't leave it in a cleaner state. I have improved upon some of the ideas developed here in other projects though.

Part of the trouble may be that the master branch has been partially re-factored to work independent of golly. In order to use this with golly you will want to check out the golly branch then

find golly's install directory and then merge our 'golly' folder with the install directory (called 'golly' by default). HINT: golly's home directory will be something like '/usr/share/golly' for ubuntu or 'C:\Program Files\golly' for windows. The file structure should be properly set up to make sure all scripts, rules, and patterns end up in their right place.

...assuming golly's directory structure hasn't changed in the last year or so.

Please give this a try and let me know how it goes. I'd like to update the README at least to include this if it works.

7yl4r commented 6 years ago

I've just sent an invite for push access as well.

nhpackard commented 6 years ago

Hey! thanks for the quick response!

I got it to work using your instructions, where for "merge our 'golly' folder with the install directory" I went to my golly-code repo and executed:

(cd ../LifeGenes/golly; tar cf - Scripts) | tar xvf -
(cd ../LifeGenes/golly; tar cf - Rules) | tar xvf -
(cd ../LifeGenes/golly; tar cf - Patterns) | tar xvf -
find . -name "*.pyc" -exec rm {} \;

Can you say a word about what you mean by "re-factored to work independent of golly"?

One other question: do you know of any way to run golly python scripts outside of the golly GUI? Is there any way to install the golly python module so I can say import golly as g to my python prompt (or... to my jupyter notebook prompt)? Where does the python code for the golly module actually live?

I have improved upon some of the ideas developed here in other projects though.

I would be very interested in hearing about any related projects.

7yl4r commented 6 years ago

Can you say a word about what you mean by "re-factored to work independent of golly"?

The plan was to use this from within a standalone application as a python library, but I am not sure how far along I got with it before deciding to just start over instead. There are much better ways to implement the ideas here. For instance: this project uses strings to represent genes which is slow and unnecessarily cryptic.

One other question: do you know of any way to run golly python scripts outside of the golly GUI? Is there any way to install the golly python module so I can say import golly as g to my python prompt (or... to my jupyter notebook prompt)? Where does the python code for the golly module actually live?

Sadly I don't know the answers to these questions. I have a vague memory of thinking about them myself back when I was planning the refactor I mentioned above, but I don't think I ever found the answers.

I would be very interested in hearing about any related projects.

The furthest along I got with these ideas was in EmergentOrganization/cell-rpg. Although the main point of that project was to make a game, I branched off a bit and implemented cellular automata genetics as "Digital Gene Regulation Networks" (DGRN). Here are some rough notes I made on the subject while working on it. The implementation is in java and should be easy to break out of the main project. You can find it in that project as DGRN4j.

I still believe the "game" itself has a lot of potential to create interesting interactions between a 2d physical space and multiple grids of automata. My dream was to develop it into a Cellular-automata experiment platform where one could apply selective pressures to genetic automata using simple AI agents to nurture and cull cells within the 2d game-world. In this way I think it may be possible to breed cell lines which perform simple cell differentiation to co-operate as complex organisms... but that kind of stuff doesn't pay the bills. :sweat_smile:

nhpackard commented 6 years ago

Thanks for the pointers!

I am working on a version that adds genes to live cells, with the genes influencing the birth process.

We have currently abandoned any thought of using golly, and instead are using a fast C implementation combined with a python front end for exploration.

I'll let you know if we end up with any interesting results.

7yl4r commented 6 years ago

We have currently abandoned any thought of using golly

This is the same conclusion I came to. Golly scripting is just too limited to allow for the kinds of things I wanted to do.

a fast C implementation combined with a python front end for exploration.

I'll let you know if we end up with any interesting results.

Yes, please email me with any updates at tylar@tylar.info

I would love to contribute to a project like this or discuss the results, and I am looking for ways to steer my career more in this direction.