Beta
Loop Through Conway's Game of Life
11bellmyer
Loading description...
Algorithms
Cellular Automata
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
This kata is merely a trivial combination of two unrelated tasks (evaluating GoL state and finding tail/loop size of a linked chain) which individually already have katas of, so this is a duplicate.
This kata is not solvable in general; a glider, for example, will not loop at all.
Could anyone make Python or JS translation, please?
no random tests (or at least, enough randomized ones?)
It would be good to include the life/death rules so that this kata could be completed without the dependency on wikipedia.
Here are some things that I think would make this Kata better: Have test cases that are of non-square grids. Give an estimate in the description for how large boards and how long tails and loops the code should be able to do. And although I think it's minor, it's nice to have one randomized test so that it's impossible to save the answers to complete the kata.
Good work!
This Kata seems really interesting. A small question though, are the edges joined together? Say a glider went out the right side, should it come back on the left?
Yeah, I might not have been clear enough in my description, but that's what I meant by "pacman-style" :) I'll see if I can clarify the wording.
Pacman style? But it should wrap around then? I'll give it a try! :)
Sorry, I must have removed the "pacman-style" comment I originally had :) I updated the description, and even added an example that I hope helps. Let me know how it goes!
Are the given test case in "Your Test Cases" really correct then? Or have you changed it since I started? I don't think
should have a tail at all? Since all cells will be in reach of eachother...I could really need some help. On the first 5x5 board I just can't see how it can be a tail=2, loop=2 solution. I get a tail=16, loop=1 answer. I've tried checking my boards for errors, but it's kind of tough to hand check 17 5x5 boards. Could you please post the four boards of the first test so I can compare my boards with it, so I can track down my error? It's the one starting with
. It would be much appreciated!Indeed you are right! When building the "next grid", I was initializing my 2-dimensional array like this:
Which gives you:
That looks correct for a 3x3 grid, but what you can't see is that all three sub-arrays are the same object. Therefore, changing one changed all, and all three rows ended up being identical. Woops! I'm going to fix the test cases now.
Very sorry for the mixup. I've corrected everything - my solution code, the test suite, and the example test suite. Thank you very much for finding this glitch!
Okay, so I had the code right after all. :P It was a fun exercise, I hope more people will try it. :)