Discuss about the multidimensional arrays

Assignment Help Computer Engineering
Reference no: EM132153455

I am having trouble setting up this C++ program. He wants us to use in and out stream to get out blinker and beacon. Below is the only provided instructions on the project.

"Overview: We need to start with the types of C++ tasks that should be included in the final project. We have true multidimensional arrays to work with now.

We will be talking about class objects in the coming days. We've also been doing file IO for several weeks and have had a lab #8 using it. So we end up with Conway's "Life" which can encompass all of these C++ tasks in one, hopefully, rewarding end of semester project.

The book does a very good job of describing the logic and implementation of the game. LIFE is so well known that a vast array of resources pertaining to it can be found on the internet.

Tasks: Since the project is in chapter 7, the book's version doesn't work with classes and it doesn't have any file IO. Let's address the file IO first. On the project download page in addition to the usual items there will be two data files containing very simple life community specifications.

The files have the following format: first item in the file is the number of rows the community requires, second item in the file is the number of columns the community requires, third item is the LIFE community which is stored as ‘.' (dead) or ‘O' (alive) characters in the array shape specified by the preceding two values. Here is an example of a configuration know as a still life block which can be found on the Wikipedia page:

4

4

....

.OO.

.OO.

....

In order for your project to work with these inputs you will need to specify a two dimensional array. The book specifies a 22 by 80 array. The GTA project uses a 50 by 100 (row by col) array. So long as your array is larger than the size specified by the input, your code will work with the input.

After creating the array, the code reads in the data from the input and fills out your LIFE community array with a small twist. The book suggests filling in the grid directly with asterisks for live cells and blanks for dead cells. We will use class objects instead.

The normal implementation of LIFE uses two identical arrays. One stores the now generation and one is used to store the next generation. (see the book pgs 446 & 447) We will be using one array which contains LIFE cell objects made from the simplest useful class we could think of. Our class objects will contain two Boolean data items that store the cell's life condition and one function which will age the cell.

Anti-Chaos:

Your LIFE community's size should be square and an edge length is define globally as const int edge=#. Your class is named cell and contains the public boolean variables aod_d0, aod_d1 and the void function age(). Create a general function that counts the number of living neighbors of a cell and declare its type with the following declaration: int nbors_sum(cell[edge][edge], int, int, int, int);. Your LIFE community ages a day at a time so create a general function that reads cells at d0 and determines whether that cell is alive or dead (aod) at d1.

It's declaration is: void oneday(cell[edge] [edge], int, int);. The oneday function will call the nbors_sum function. The GTA version has a fair amount of code in main() including file input and the while(true) display loop.

No credit challenge extras:

If you'd like to take full advantage of your computer's capabilities, then attempt to place the initial LIFE community at the center of the community array rather than at the upper left corner.

There is a bit of additional math associated with doing this and perhaps the addition of a number of extra variables. If you can get the modification working there are additional LIFE community seeds available from your GTAs and the internet.

Deliverables:

A project report in PDF format.

Reference no: EM132153455

Questions Cloud

Experiences or practicum observations : In your experiences or practicum observations, what classroom setups did you find most useful? How do you see implementing these components in your classroom?
What if the size of the usb flash drive is increased : You also have an LTE data card that connects to your portable computer and receives data any where you're located at a rate of 50 Mbps.
Regarding the effects of a soda tax on other people : Setting self-interest to one side, what is your opinion regarding the effects of a soda tax on other people?
Why twitter is a unidirectional network and facebook is not : The tributaries of the Mississippi River follow a Power Law. Can you explain which variables should go on each axis?
Discuss about the multidimensional arrays : We need to start with the types of C++ tasks that should be included in the final project. We have true multidimensional arrays to work with now.
Create a pointer structure that has members : Create a pointer structure that has members for the x and y coordinates. Use typedef to make a point_t data type.
Why cache memory is faster than main memory : List four types of memory (storage) in the computer memory hierarchy. What is locality principle?
Calculate the opportunity cost : Calculate the opportunity cost and show the answer and the calculation. Should the company ask Bill to make the extra clutches or not?
Relationship between the current accounts of the two : What relationship between the current accounts of the two countries is satisfied when the world real interest rate is at its equilibrium value?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Compare by using exception handling for input data

compare using exception handling for input data validation with using if and switch statements. when would you use each

  Write a constructor that initializes these values

Design a class named Person with fields for holding a persons name - Write a constructor that initializes all of these values, and mutator and accessor methods for every field. Next, design a class named Customer, which inherits from the Person cla..

  Explain why you can not input text to the editor

In what ways can a process behave when it receives a signal? Invoke the command vi foo &, and explain why you can't input text to the editor.

  Explain how advances in technology affect digital forensics

Analyze the impact of technological changes on digital forensics techniques. Explain how advances in technology affect digital forensics. Examine changing methods for extracting evidence from a new technology.

  Describe the sources of potential errors in the final set

question 1 what is the relationship between precision and turr.question 2 discuss the sources of potential errors in

  Based on the article fast windows fixes how would you or do

based on the article fast windows fixes how would you or do you use your windows knowledge to be efficient at

  Computes the average of all those numbers

Select minimum number of test cases to achieve 100% statement coverage in ReturnAverage()

  The program is displaying wrong output correct it

Problem - The program is displaying wrong output when entering a number

  Who would be some internal stakeholders

A new grocery store is being erected that will demolish a neighborhood basketball court. Who would be some internal stakeholders?

  Implement abstract type representing each rational number

Implement your abstract type, representing each rational number by a pair of integers (m, n).

  Give five best practices which computer system builders

question 1 provide five best practices that computer system builders should use when determining the file system to use

  Binary hypercube and a barrel shifter

Consider an illiacmesh (8*8) ,a binary hypercube and a barrel shifter, all with the 64 nodes labelled n0,n1…n63.all network links are bidirectional.

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