Week 7: Friday -------------- Q1. (30) The Ackermann function for non-negative integers m and n is defined as: A(m, n) = n + 1 if m = 0 A(m, n) = A(m - 1, 1) if m > 0, n = 0 A(m, n) = A(m - 1, A(m, n - 1)) if m > 0, n > 0 Write a function to implement it. In the main function, input two non-negative integers m and n, and compute A(m, n). You can assume that m <= 3 and n <= 4. Q2. (70) Consider a two-dimensional world divided into cells. Each cell is either "dead" or "alive" at a given "generation". A set of rules describe how the cells evolve from generation to generation. These rules calculate the state of a cell in the next generation as a function of the states of its neighboring cells in the current generation. A cell’s neighbors are those 8 cells vertically, horizontally, or diagonally adjacent to that cell. The rules are: 1. A live cell with fewer than two live neighbors dies. 2. A live cell with more than three live neighbors also dies. 3. A live cell with exactly two or three live neighbors lives. 4. A dead cell with exactly three live neighbors becomes alive. Consider a finite version of the two-dimensional world of size 10x10. (Assume that a layer of dead cells surround this world on all 4 sides.) Assign the initial states through the random function. Use the function rand() that returns a random integer. You can use this functoiin to generate a random integer within a particular range. For example, to generate a random integer between 1 and 10, you need to use (1 + rand() % 10). Use the rules defined above to simulate the world for 5 generations. After each generation, print the state of the cells. Make sure you print such that the 10x10 world is formatted correctly. Next, run the simulation for 50 iterations and report if it stabilizes, i.e., none of the cells change between two generations.