Menu

[Solved]Key Items Key Items Marked Red Failure Include Complete Key Items Incur Additional Deducti Q37259692

KEY ITEMS: Key items are marked in red. Failure to include or complete key items will incur additional deductions as noted be4 Cell5 678 If a cell contains an organism and has fewer than 2 neighbors, the organism dies of loneliness. o A neighbor is a. The use of pointers is required to traverse the array. The final bacteria generation will be written to a file. Input: The

KEY ITEMS: Key items are marked in red. Failure to include or complete key items will incur additional deductions as noted beside the item. Submission and Grading: All project deliverables are to be submitted in eLearning. Zip all of the source files into a single zipped file Make sure the zipped file has a.zip extension (not.tar,.rar, .7z, etc.) (-5 points) Type your name and netlD in the comments at the top of all files submitted. (-5 points) Objectives: Allocate memory dynamically Utilize pointers to directly manipulate memory Problem: Simulation games remain a popular genre of video games and you have decided to capitalize on their success by designing SimBacteria. Given an area randomly populated by single cell organisms, players will be able to watch their cultures thrive (or die) throughout many generations of bacteria. Your program will drive the simulation and display each generation before recording the last generation into a file. SimBacteria Rules Each cell has at most 8 neighbors (cells on the edge of the world will have fewer): 123 4 Cell 5 4 Cell5 678 If a cell contains an organism and has fewer than 2 neighbors, the organism dies of loneliness. o A neighbor is an organism in one of the 8 spots (or fewer if on the edge) around a cell If a cell contains an organism and has more than 3 neighbors, it dies from overcrowding. If an empty location has exactly three neighbors, an organism is born in that location. All births and deaths happen simultaneously. o No changes should be made to the world until all cells have been tested. Details The world in which the bacteria live will be implemented as a 2-dimensional array. The array will be dynamic (-10 points if not) The size of the array will be determined by the file containing the initial bacteria generation. o o You may create a dynamic multi- or single dimension array Dynamic multi-dimensional arrays require double pointers (which we will not cover) This is an option for students with a more advanced skill set. ” Remember that standard multi-dimensional arrays in C++ are stored as single dimension arrays in o memory This may be easier to work with than the double pointers. The initial bacteria generation will be read from a file. . The use of pointers is required to traverse the array. The final bacteria generation will be written to a file. Input: The initial bacteria generation will be read from a file named simbac.txt. Each line in the file will represent a row in the 2D array. The array you create is to be no bigger than the initial bacteria generation presented in the file. You will need to determine how many rows and columns are in the file before creating the array Each row will contain two types of characters: asterisks (*) or a space. An asterisk represents an organism and the space represents an empty cell. Each line of the file will end with a newline character, except the last line. The last line may or may not have a newline character at the end Once the file has been read into memory, prompt the user to enter the number of generations to simulate. The maximum number of generations allowed for simulation is 10. You must validate that the user only enters an integer from 1-10. If the user enters invalid data, display an error message and prompt the user for correct input. Output: After the user has entered a valid number, display each generation to the console. The last generation will be displayed to the console as well as written to the file (simbac.txt). Use an asterisk (*) to indicate an organism during output. Hints: You should consider a second 2-dimensional array to mark births and deaths . This allows you to evaluate births and deaths simultaneously by modifying a copy of the world rather than the original o There are 3 rows of neighbors for cells. It may be easier to check neighbors by using a pointer for each row of neighbors Remember the border cases have fewer neighbors Show transcribed image text KEY ITEMS: Key items are marked in red. Failure to include or complete key items will incur additional deductions as noted beside the item. Submission and Grading: All project deliverables are to be submitted in eLearning. Zip all of the source files into a single zipped file Make sure the zipped file has a.zip extension (not.tar,.rar, .7z, etc.) (-5 points) Type your name and netlD in the comments at the top of all files submitted. (-5 points) Objectives: Allocate memory dynamically Utilize pointers to directly manipulate memory Problem: Simulation games remain a popular genre of video games and you have decided to capitalize on their success by designing SimBacteria. Given an area randomly populated by single cell organisms, players will be able to watch their cultures thrive (or die) throughout many generations of bacteria. Your program will drive the simulation and display each generation before recording the last generation into a file. SimBacteria Rules Each cell has at most 8 neighbors (cells on the edge of the world will have fewer): 123 4 Cell 5
4 Cell5 678 If a cell contains an organism and has fewer than 2 neighbors, the organism dies of loneliness. o A neighbor is an organism in one of the 8 spots (or fewer if on the edge) around a cell If a cell contains an organism and has more than 3 neighbors, it dies from overcrowding. If an empty location has exactly three neighbors, an organism is born in that location. All births and deaths happen simultaneously. o No changes should be made to the world until all cells have been tested. Details The world in which the bacteria live will be implemented as a 2-dimensional array. The array will be dynamic (-10 points if not) The size of the array will be determined by the file containing the initial bacteria generation. o o You may create a dynamic multi- or single dimension array Dynamic multi-dimensional arrays require double pointers (which we will not cover) This is an option for students with a more advanced skill set. ” Remember that standard multi-dimensional arrays in C++ are stored as single dimension arrays in o memory This may be easier to work with than the double pointers. The initial bacteria generation will be read from a file.
. The use of pointers is required to traverse the array. The final bacteria generation will be written to a file. Input: The initial bacteria generation will be read from a file named simbac.txt. Each line in the file will represent a row in the 2D array. The array you create is to be no bigger than the initial bacteria generation presented in the file. You will need to determine how many rows and columns are in the file before creating the array Each row will contain two types of characters: asterisks (*) or a space. An asterisk represents an organism and the space represents an empty cell. Each line of the file will end with a newline character, except the last line. The last line may or may not have a newline character at the end Once the file has been read into memory, prompt the user to enter the number of generations to simulate. The maximum number of generations allowed for simulation is 10. You must validate that the user only enters an integer from 1-10. If the user enters invalid data, display an error message and prompt the user for correct input. Output: After the user has entered a valid number, display each generation to the console. The last generation will be displayed to the console as well as written to the file (simbac.txt). Use an asterisk (*) to indicate an organism during output. Hints: You should consider a second 2-dimensional array to mark births and deaths . This allows you to evaluate births and deaths simultaneously by modifying a copy of the world rather than the original o There are 3 rows of neighbors for cells. It may be easier to check neighbors by using a pointer for each row of neighbors Remember the border cases have fewer neighbors

Expert Answer


Answer to KEY ITEMS: Key items are marked in red. Failure to include or complete key items will incur additional deductions as not… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *