Question: Task 1 A: Building Randomly a Society [ 1 0 marks ] In this task, we are going to define the function build _ society

Task 1A: Building Randomly a Society [10 marks]
In this task, we are going to define the function build_society (m,n), which builds an mn society
randomly populated with live and dead cells.
Assumptions
,m and n1
Output must be a list of lists
Note: As long as the result of your function returns an mn society randomly populated by dead and live
cells, your solution will be accepted. There is also no need to set the random seed for computation.
Example Run
{:[^(')-^('),^(')^(')],[^(')-^('),^(')],[^('**),^('')]]...
....
... Task 1B: Modeling a Society [15 Marks]
As we have observed from Task 1A, we have not much control over the life or death of a cell in the society
built. In this task, we instead would like to take control over the life or death of every cell when we build a
society. For instance, the society built in the last sample run of Task 1A is replicated below:-**+=
....
.
Here, we want to model a society based on this resultant society. We shall take in this resultant society,
which consists three strings of characters, and convert it into proper internal structure of a society: List of
lists of characters of '-' and ' cdots '. To be precise, we copy the printed society and paste it as the argument to
our model_society function.
Sample runs (outputs are highlighted in blue for clarity):*+%.
`'')=+.=
=-.=* Task 1C: Coding the Game-Of-Life Rules [15 Marks]
Our next task is to turn the set of Game-of-Life rules into a function. Specifically, we notice that whether a
cell will be destined to live or die depends on two factors: (1) its current liveness: either it is alive or dead at
the moment; and (2) the number of live neighbors surrounding it.
Write a function gol(cell_value, live_neigh) that takes in (1) a Boolean value representing live (by True)
and dead (by False); and (2) an integer between 0 and 8(both inclusive) capturing the number of live cells in
its (maximum eight) neigbourhood. The function returns True when the cell will be alive in the next
evolution, and False otherwise. Your function should define correctly the game-of-life rules, as replicated
below:
Any live cell with fewer than two live neighbours dies, as if caused by loneliness.
Any live cell with two or three live neighbours lives on to the next generation, as if sustained by
friendship.
Any live cell with more than three live neighbours dies, as if caused by over-crowdedness.
Any dead cell with exactly three live neighbours becomes a live cell in the next generation, as if by
reproduction.
Sample runs:
gol(True,3) # Current cell is alive, three live neighbor
True # The cell is destined to die in the next evolution
gol(False,3) # Current cell is dead, three live neighbor
True # The cell is destined to live in the next evolutionTask 1D: Tabulating Game-of-Life Rules [15 Marks]
As we begin to explore different ways of defining game-of-life rules, we want to be certain about the effect
of our defined rules. A way to ascertain the effect is to display the results of the rules given the current cell
value and the number of live neighbours.
Write a function tabulate(rules) that takePart 1: Conway's Game-of-Life [100 marks]
The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician
John Horton Conway in 1970. It is a zero-player game, meaning that its evolution is determined by its initial
state, requiring no further input. One interacts with the Game of Life by creating an initial configuration and
observing how it evolves.
-- Wikipedia
We are interested in observing the state of a Game-of-Life simulation.
The simulation begins with a rectangular society of size mn(m rows, n columns), with any of mn cells
may be dead or alive. Our task is to monitor the evolution of the cells in this society for several generations
(as determined by the user) based on the following four Game-of-Life Rules:
Any live cell with fewer than two live neighbours dies, as if caused by loneliness.
Any live cell with two or three live neighbours lives on to the next generation, as if sustained by
friendship.
Any live cell with more than three live neighbours dies, as if caused by over-crowdedness.
Any dead cell with exactly three live neighbours becomes a live cell in the next generation, as if by
reproduction.
Note that cells can have up to 8 neighbours, where a neighbour is a cell that is directly adjacent or diagonal
to the cell.
For example, given the following demography of a 65 society (here a dead cell is represented by '-', and
a live cell is represented by ?'*' respectively)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!