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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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