“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.”
“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.”
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Jeanne Boyarsky wrote:So what more specific question do you have?
“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.”
Victoria Li wrote:I don't know exactly how to begin. How would I be able to get a user input for the empty and filled spaces in a 200x60 two-dimensional array?
Carey Brown wrote:
Victoria Li wrote:I don't know exactly how to begin. How would I be able to get a user input for the empty and filled spaces in a 200x60 two-dimensional array?
Seems like entering (up to) 200x60 cells would be extremely tedious and error prone. You could instead read a file with the cell configuration. Perhaps something like:
You could have an option to fill in the cells with random booleans. The specs seem to leave it up to you.
“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.”
I'm required to begin with a 200x60
Victoria Li wrote:
Carey Brown wrote:
Victoria Li wrote:I don't know exactly how to begin. How would I be able to get a user input for the empty and filled spaces in a 200x60 two-dimensional array?
Seems like entering (up to) 200x60 cells would be extremely tedious and error prone. You could instead read a file with the cell configuration. Perhaps something like:
You could have an option to fill in the cells with random booleans. The specs seem to leave it up to you.
That would be a better idea, but I'm required to begin with a 200x60 and have a user input the empty/filled spots.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Carey Brown wrote:...Where I think your approach runs into difficulty is in generating new life where you must visit each cell to determine if it should be changed to a live cell. This would be trivial in a 2D array (array-of-arrays) but be much more difficult with your approach.
salvin francis wrote:
If this was the original state :
Rule#1 says to kill (Any live cell with fewer than two live neighbors dies as if caused by underpopulation.)
It should turn to:
but wiki follows the Rule#4 first and then Rule#1 making it :
salvin francis wrote:Or is it based on scanning the whole board and noting down items to be created, destroyed and then doing it 'all at once' ?
salvin francis wrote:Just realized that "Generation" is a bad name
Liutauras Vilda wrote:(...)
That’s correct
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:
Liutauras Vilda wrote:(...)
That’s correct
No it is not. The vertical bar goes directly into the horizontal bar, and vice versa. For each cell find out the rule to apply.
Thou shalt not try me. Mom 24:7
Jim Venolia wrote:You'll want 2 arrays. One is the current generation, the other the next generation.
Liutauras Vilda wrote:Couldn't you calculate cells provisional state for the next generation without fiddling with 2 arrays? And when the time comes just build cells of such states?
Thou shalt not try me. Mom 24:7
Jim Venolia wrote:...Works because 90-99% of your board isn't going to change generation to generation.
There are three kinds of actuaries: those who can count, and those who can't.
Stephan van Hulst wrote:.... I especially like that the grid wraps around. I hadn't considered that in my design.
Victoria Li wrote: "The Game of Life is played on an infinite two-dimensional grid of square cells"
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |