Implement the sparse life grid adt

Assignment Help Basic Computer Science
Reference no: EM131312836

In Programming Project 4.1, you implemented the Sparse Life Grid ADT that creates a game grid of unlimited size for use with the game of Life. That implementation used a single Python list to store the individual live cells, which was similar to the technique we used with the Sparse Matrix ADT. Explain why the array of linked lists structure used to implement the Sparse Matrix ADT in this chapter cannot be used to implement the Sparse Life Grid ADT.

Programming Project 4.1:

The game of Life is defined for an infinite-sized grid. In Chapter 2, we defined the Life Grid ADT to use a fixed-size grid in which the user specified the width and height of the grid. This was sufficient as an illustration of the use of a 2-D array for the implementation of the game of Life. But a full implementation should allow for an infinite-sized grid. Implement the Sparse Life Grid ADT using an approach similar to the one used to implement the sparse matrix.

* SparseLifeGrid(): Creates a new infinite-sized game grid. All cells in the grid are initially set to dead.

* minRange(): Returns a 2-tuple (minrow, mincol) that contains the minimum row index and the minimum column index that is currently occupied by a live cell.

* maxRange(): Returns a 2-tuple (maxrow, maxcol) that contains the maximum row index and the maximum column index that is currently occupied by a live cell.

* configure( coordList ): Configures the grid for evolving the first generation. The coordList argument is a sequence of 2-tuples with each tuple representing the coordinates (r, c) of the cells to be set as alive. All remaining cells are cleared or set to dead.

* clearCell( row, col ): Clears the individual cell (row, col) and sets it to dead. The cell indices must be within the valid range of the grid.

* setCell( row, col ): Sets the indicated cell (row, col) to be alive. The cell indices must be within the valid range of the grid.

* isLiveCell( row,col ): Returns a boolean value indicating if the given cell (row, col) contains a live organism. The cell indices must be within the valid range of the grid.

* numLiveNeighbors( row, col ): Returns the number of live neighbors for the given cell (row, col). The neighbors of a cell include all of the cells immediately surrounding it in all directions. For the cells along the border of the grid, the neighbors that fall outside the grid are assumed to be dead. The cell indices must be within the valid range of the grid.

Reference no: EM131312836

Questions Cloud

Implementation and effects of different scheduling policies : In this lab we explore the implementation and effects of different scheduling policies discussed in class on a set of processes/threads executing on a system. The system is to be implemented as a Discrete Event Simulation
Summarize the video and the main themes contained in it : Summarize the video and the main themes contained in it.Connect these themes to what we have covered and what you gave learned during the course.
Estimate the total cost for the project : Estimate the costs for the resources, and add the costs to the resource information in the Microsoft Project file. Estimate the total cost for the project, using the Microsoft Project budget or cost reports.
Difference between bonds current yield and yield to maturity : Why may a bond's price change simply because of the passage of time?.- What is the difference between a bond's current yield and its yield to maturity?
Implement the sparse life grid adt : minRange(): Returns a 2-tuple (minrow, mincol) that contains the minimum row index and the minimum column index that is currently occupied by a live cell.
What characteristics of a bond affect its reinvestment risk : What assumption is made about reinvestment of cash flows when using the yield to maturity?- What characteristics of a bond affect its reinvestment risk?
Protect the privacy rights of students : The Family Education Rights and Privacy Act (FERPA) was passed in 1974 to protect the privacy rights of students in higher education institutions. It is appropriate to mention that the motivation for the passage of FERPA was generated by the desir..
Explain the applicable pennsylvania law : Explain the applicable Pennsylvania, New Jersey, and New York law regarding the following:The type of employee for whom the restriction is appropriate;the length of time, the geographic range, and the scope of a restrictive employment covenan.
Implementation of the big integer adt : Modify your implementation of the Big Integer ADT from the previous question by adding the assignment combo operators that can be performed on the self and rhsInt big integers.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Management roles-various law enforcement agencies

Review chapter 5 and create a table listing and ranking (from first to last and according to relative importance when responding to a disaster) the different it management roles, various law enforcement agencies, emergency agencies/organizations

  The low and high integer in a range of integers

The low and high integer in a range of integers

  Themselves and information friends post about them

Visit two or more social media sites and review information that people post about themselves and information friends post about them. What types of information is available? What challenges do corporations face with regards to social media? Do co..

  What is the output of the program below

What is the output of the program below?

  Future applications will change manufacturing industry

Prepare a response which explains the future applications which will change manufacturing industry, judiciary, and field of sports. Explain at least one application for each field.

  How enterprise architecture and enterprise systems

1. How enterprise architecture and enterprise systems influence, support, and enable an organization's ability to contribute to strategic decision-making.2. How enterprise architecture and enterprise systems respond and adapt to the business environm..

  Write an instruction sequence to swap the upper four bits

Write an instruction sequence to swap the upper four bits and the lower four bits of accumulator A(swap bit 7 with bit 3, bit 6 with bit 2, and so on).

  Equilibrium price and quantity of butter

Question 3:What will happen to the equilibrium price and quantity of butter in each of the following cases?Illustrate with a diagram and explain whether demand or supply (or both) have shifted and in whichdirection? (In each case, assume ceteris pari..

  Number of cpu processing cycles

Taking into account the availability of today's powerful computers, why is programming efficiency important? Consider how the number of lines of programming instructions impact the number of CPU processing cycles?

  Asynchronous transaction processing mode

When operating in an asynchronous transaction processing mode, what information must be present in both the pending request and the received response messages for the response to be exclusively matched to its associated pending request?

  Explain swot analysis in the context of product and process

a. Explain SWOT Analysis in the context of product and process innovation. b. Mention and explain FIVE (5) benefits of entrepreneurship. c. Discuss the impact of Technology Innovation and Society course in your career.

  How the identity of users should be managed has been address

A network of wireless access which is provided in a nationwide network of hotels;

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd