• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with alternative Game of Life rule family  RSS feed

 
Alex Klempae
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been toying with the idea of taking the Life-like cellular automation Generations and using it to do something creative and useful for a while now, but after my first few attempts I've hit a problem. I submitted this question to another online source, but no help came from that. The only help I received was a suggestion to move from procedural to object oriented, which isn't my problem.

Generations is like Conway's Game of Life except that when a cell dies it continues to occupy that space for a number of generations, dramatically altering the way the cells behave. Examples of this family can be seen in the following two open source cellular automata applications: Colorful Life (select Generations from the Family drop-down menu on the right) and MJCell (select Generations from the first drop-down menu on the left).

My code is at the bottom of his post. It's nowhere near the entire thing, but this is the smallest bit of code I can come up with that illustrates my problem. I've been out of practice coding for a little while so it's pretty rough. The code I've come up with is flawed and I don't know where. I've come to this conclusion by comparing it to a program that works (MJCell). My procedure is to change the MJCell grid size to match my program's size (10x10), making the rules for both programs the same, transcribing the first generation of my randomly seeded grid into MJCell, and comparing subsequent generations. If I didn't make any mistakes in my coding the subsequent generations in my program should be the same as those of MJCell, but they are not, and I'm not sure what to do at this point. I've been trying to fix it in what little time I have to no avail. The second generation is as it should be but from there on out it's messed up. I would really appreciate it if someone could help me figure out where I went wrong. Thanks!


 
Knute Snortum
Sheriff
Posts: 4281
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

I'm going to move this to the regular Java forum since it doesn't look like a beginning questions, BUT...

It's hard to help you when the question is so vague. Can you give us a specific problem? Maybe post the Game of Life's algorithm?
 
Paul Clapham
Sheriff
Posts: 22832
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, the problem is a bit hard for us to get a handle on. So what I would suggest is this: starting with random entries in your grid is maybe not a good testing plan. Perhaps doing something more systematic until you find repeatable problems would be better? Or when you find a pattern where your code differs from MJCell, print it out and repeat that until you get enough differences that you can look for patterns?

I know that doesn't sound very helpful, but your code looks pretty straightforward to me and I don't see any obvious bugs. What I would be doing, I think, is to look for patterns in the grids which don't come out right in the next generation.

And just for completeness I have to ask: Are you sure MJCell is doing it right? Have you taken a grid which your code handles differently than MJCell does and worked it through by hand?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!