I’m sorry for the weird title. I don’t know how to word this.
If I have function func()
How do I do this:
func(func(func(func(func(x)))))
where it repeats N times?
I’m trying to implement Conway’s Game of Life. I have a function that takes a vector and outputs another vector, which is the next generation of the input vector. So generation 3’s vector would be func(func(func(x))).
>Solution :
The easy way, simply using for loop:
int x = some_initial_value;
for (int i = 0; i < NUMBER_OF_ITERATIONS; ++i)
{
x = func(x);
}