"Alf P. Steinbach" wrote:
I would like to use polymorphic programming in the sense that each
cell's identity will change (it will be a dead cell or live cell) based
on the inputs or functions that act on it. I am debating whether some
basic selection/repetition statements are the best way the develop the
basic logic of the game, or if there is some way to incorporate virtual
functions with dynamic binding into the program, so that each cell is
exhibiting the behavior of surviving or dying based on conditions in
the cell's environment. Regardless of whether my functions are virtual
or static, I will need them to act on a cell so that they communicate
to a cell how many neighbors it has and then cause the cell to live or
die based on the number of neighbors.
It's not a good idea to abstract up low level things. It's not a good
idea to start abstracting at all, before you have enough of a grip on the
problem to be able to do it without any fancy stuff. It's not a good idea
to decide in advance what tools you'll bring to bear on a problem you
don't yet understand.
Since you're off on entirely the wrong foot, the only advice I can offer
is to not think in terms of /a/ program: you need to first create a
smallest possible text only program that does this thing with no more
abstraction than absolutely necessary, just to understand what you're
trying to do. The program should work. And you should understand why.
Then work iteratively, creating a second program, and a third.
I set this aside earlier in the week and have finally read the OPs post. I
would loudly say AMEN to what is said here. Instead of attacking the
problem, you have gotten fascinated with a bunch of fancy-shamcy buzzwords.
written by guys who knew zilch about virtual functions and dynamic binding.