diff_months: 17

ITECH 1400 Foundations of Programming

Download Solution Now
Added on: 2023-02-04 11:01:46
Order Code: CLT315125
Question Task Id: 0

1. Introduction.

In this assignment you are required to develop a Python program to run Conway’s Game of Life on a finite board.

Here are the definitions (from Wikipedia):

1.1 The Classical Game of Life

The Game of Life was invented by British mathematician John Horton Conway in 1970.

The universe of the Classical Game of Life is an infinite two- dimensional grid of square cells, each of which is in one of two possible states, alive or dead (1 or 0). Every cell interacts with its eight neighbours, which are the cells that are horizontally, vertically or diagonally adjacent. At each step, the following transitions occur:

  1. Any live cell with fewer than two live neighbours dies, as if caused by under-population.
  2. Any live cell with two or three live neighbours lives on to the next generation.
  3. Any live cell with more than three live neighbours dies, as if by overcrowding.
  4. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.

The initial pattern constitutes the seed of the system. The first generation is created by applying the above rules simultaneously to every cell in the seed — births and deaths occur simultaneously. The rules continue to be applied repeatedly to create further generations.

Below are two examples of interesting initial patterns:

1.2 The Game of Life on Torus (GLT).

In the assignment you are required to develop a Python program for the Game of Life restricted to a finite board (n n).

It is same as the classical game of life except that we assume that the left border of the board is glued to the right border, and the top border of the board is glued to the bottom border. So, there are no borders, and the game is played on a torus. See the details in the next section.

1. Programming Tasks and Implementation Requirements.

1.1 The board of GLT

  • The board of GLT should be implemented as a two-dimensional (???????? × ????????)list of integers that contains only zeros and ones.
  • Elements of the list represent cells of GLT’s universe: Zero elements represent dead cells, elements that are equal to one represent live cells.
  • Transition rules (1-4) of the restricted game are the same as those of the classical game.
  • Eight neighbours of the cell board[i][j] should be computed by the following rules:



board[(i-1+n)%n][(j+1)%n], board[i%n][(j+1)%n],


board[(i+1)%n][j], board[(i+1)%n][(j-1+n)%n],


Where is the length of the board’s side. The modulus (%) operator is used in the formulas for neighbours because the game will be played on a torus, not on a plane. See section 0.2.

1.2 Develop GameOfLife class.

The class must have an attribute named board, which should be defined in the constructor. The board attribute is a two- dimensional square list as described in the previous section.

You may define other attributes in your class, if required. Also, the class should define the following methods:

neighbourSum(self,i,j) – the method computes and returns the number of live neighbours of the cell board[i][j]. The neighbours of board[i][j] are listed in section 1.1.

nextPattern(self) – changes the board’s current pattern to the next one according to the game’s rules. See section 0.1.

printBoard(self) – prints the current pattern, replacing zeros with white spaces and ones with ‘*’. Similar to the picture below:

2. Write main() function.

This is a driver program where you test your implementations as follows:

  • Create three initial patterns (2D-lists) for the game. You may search the Internet for interesting patterns.
  • Games should be played on the bord with dimensions 20×20.
  • Print the patterns on the screen and ask the user which one they would like to play with.
  • Once the pattern is chosen, the game starts.
  • During the game, after printing a new pattern, you should always ask if the user wants the next pattern to be printed or end the game.
  • The game ends only when the user decides so.

Get your ITECH 1400 Foundations of Programming "CONWAY'S GAME OF LIFE ON TORUS" assignment solved by our Programming Experts from Exam Question Bank . Our Assignment Writing Experts are efficient to provide a fresh solution to all question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing Style. Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered.

You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turn tin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.

  • Uploaded By : Katthy Wills
  • Posted on : February 04th, 2023
  • Downloads : 0
  • Views : 132

Download Solution Now

Can't find what you're looking for?

Whatsapp Tap to ChatGet instant assistance

Choose a Plan


80 USD
  • All in Gold, plus:
  • 30-minute live one-to-one session with an expert
    • Understanding Marking Rubric
    • Understanding task requirements
    • Structuring & Formatting
    • Referencing & Citing


30 50 USD
  • Get the Full Used Solution
    (Solution is already submitted and 100% plagiarised.
    Can only be used for reference purposes)
Save 33%


20 USD
  • Journals
  • Peer-Reviewed Articles
  • Books
  • Various other Data Sources – ProQuest, Informit, Scopus, Academic Search Complete, EBSCO, Exerpta Medica Database, and more