Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have attached everything needed for this project config1 file where is csv name time limit and refresh limit I have attched csv data for

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

image text in transcribedimage text in transcribedimage text in transcribed

I have attached everything needed for this project config1 file where is csv name time limit and refresh limit

I have attched csv data for simulation

and example simulation

please do your best to at least give us program where we find adjacent cells from csv file

thanks

Implementation Your program must provide the following functionality and adhere to the following constraints: . Your int main() should be in its own.c.cpp file All.c/.cpp files, except your main.c/main.cpp, must have associated header files. You may not #include a .c/.cpp file, only header files Allow the user to input the file containing the simulation configuration O DO NOT hardcode the filename into your program o The first line will provide the name of the file containing the region layout (DO NOT prompt the user for this filename) o The second line will provide the maximum amount of time steps the simulation can take o The third line will provide the refresh rate of how often the current state of the region should be output to the user during simulation Your system should perform the following operations: Read in and store the simulation configuration information O Read in and store the initial region layout The file will be in CSV format The region may be any sized rectangle The region contains O pollution at the beginning of the simulation . Rrepresents a residential zone Trepresents an industrial zone Crepresents a commercial zone - represents a road - Trepresents a powerline #represents a powerline over a road Prepresents a power plant o Output the initial region state - If a cell is zoned residential, industrial, or commercial and has a population of O, the letter representing the zone type should be displayed instead of its population The initial region state can be interpreted as time step 0 Simulate the development of the city over time The simulation should halt when there is no change between two, consecutive time steps or when the time limit has been reached, whichever comes first . The current time step, number of available workers, and number of available goods should be output for each timestep except time step 0 The state of the region should be output at the frequency denoted by the refresh rate in the configuration file The region is considered to be flat, and thus the edges do not wrap around to connect to each other Two cells are considered adjacent if they share an edge or corner (i.e. a cell may be adjacent to a maximum of eight other cells, and a minimum of three other cells) Each of the zoned cells will change their state according to the provided rules In the event of a decision needing to be made over two zoned cells that could grow and use available resources, the following rules must be used in order: 1. Commercial zoned cells are prioritized over industrial zoned cells ones 2. The growth of larger population zoned cells is prioritized over smaller population zoned cells (i.e. a 1 population cell will always grow before a 0 population cell) 3. The growth of zoned cells with greater total adjacent populations is prioritized over zoned cells with smaller total adjacent populations 4. The growth of zoned cells with smaller y coordinates is prioritized over zoned cells with greater Y coordinates, assuming the top left cell is 0,0 5. The growth of zoned cells with smaller X coordinates is prioritized over zoned cells with greater X coordinates, assuming the top left cell is 0,0 Residential If a cell has a population of O and is adjacent to a powerline in the current time step, that cell's population will increase by 1 in the next time step If a cell has a population of O and is adjacent to at least one cell with a population of at least 1, that cell's population will increase by 1 in the next time step If a cell has a population of 1 and is adjacent to at least two cells with a population of at least 1, that cell's population will increase by 1 in the next time step If a cell has a population of 2 and is adjacent to at least four cells with a population of at least 2, that cell's population will increase by 1 in the next time step If a cell has a population of 3 and is adjacent to at least six cells with a population of at least 3, that cell's population will increase by 1 in the next time step If a cell has a population of 4 and is adjacent to at least eight cells with a population of at least 4, that cell's population will increase by 1 in the next time step The residential population provides workers to the industrial and commercial zones, but each worker can only have one job Industrial If a cell has a population of O, is adjacent to a powerline in the current time step, and there are at least 2 available workers, that cell's population will increase by 1 in the next time step and the available workers are assigned to that job If a cell has a population of O, is adjacent to at least one cell with a population of at least 1, and there are at least 2 available workers, that cell's population will increase by 1 in the next time step and the available workers are assigned to that job 3 If a cell has a population of 1, is adjacent to at least two cells with a population of at least 1, and there are at least 2 available workers, that cell's population will increase by 1 in the next time step and the available workers are assigned to that job If a cell has a population of 2, is adjacent to at least four cells with a population of at least 2, and there are at least 2 available workers, that cell's population will increase by 1 in the next time step and the available workers are assigned to that job A cell produces pollution equal to its population, and pollution spreads to all adjacent cells at a rate of one less unit of pollution per cell away from the source The industrial population provides goods to the commercial zones, at a rate of one good per population, but each good can only be sold at one commercial cell . Commercial If a cell has a population of 0, is adjacent to a powerline in the current time step, there is at least 1 available worker, and there is at least one available good, that cell's population will increase by 1 in the next time step and the available worker and available good are assigned to that job If a cell has a population of O, is adjacent to at least one cell with a population of at least 1, there is at least 1 available worker, and there is at least one available good, that cell's population will increase by 1 in the next time step and the available worker and available good are assigned to that job If a cell has a population of 1, is adjacent to at least two cells with a population of at least 1, there is at least 1 available worker, and there is at least one available good, that cell's population will increase by 1 in the next time step and the available worker and available good are assigned to that job Output the final region state o Output the total, regional population for residential zones, industrial zones, and commercial zones o Output the final regional pollution state o Output the total pollution in the region Prompt the user for the coordinates of some rectangular area of the region to analyze more closely You must perform bounds checking to make sure the coordinates are within the bounds of the region, and reprompt the user if their coordinates are outside the bounds o Output the total population for residential zones, industrial zones, and commercial zones within the area specified by the user Output the total pollution within the area specified by the user See the example output files for formatting of each of the outputs Major functionality components must be constructed in some function, or across some functions, that are declared and defined outside of your main.c/main.cpp. Remember, function declarations must be stored in a header file, while definitions must be stored in a.c/.cpp file. You may have additional functions that support your major functionality component function. Your code must be well commented. Each group member should be performing regular commits to the GitLab repository on the Apollo server with meaningful commit messages. "Fixed bug" or "New code" are not meaningful, so try to be more specific about what was fixed or what was added. Please do not commit the example input and output files to the remote server as that may cause a space issue on the server. Beginning simulation Please enter the name of the configuratipn file:Initial Region State RRRRR CC-RRRRR-CC III-CC-RRRRR-CC | IIIII-CC-RRRRR-CCI II-CC-RRRRR-CCI III-CC-RRRRR-CCI III-CC-RRRRR-CCI - # - # - - # - # - # - # - 1 | Time Step: 1 Available Workers 5 Available Goods - CC-RRRRR-CC I-CC-RRRRR-CCI II CC-RRRRR-CCI CC-RRRRR-CCI |IIII-CC-RRRRR-CCI |IIII-CC-RRRRR-CCI |IIII-CC-11 111-CCI # # - # - # | | Time Step: 2 Available workers 9 Available Goods 2 Time step: 3 Available Workers 13 Available Goods 3 C-RRRRR-CC I-CC-RRRRR-CC! II-CC-RRRRR-CC | II CC-RRRRR-CC IIIII-CC-11 111-CC! |1 1 1 1-CC-2 2 2 2 2 -CCI 1 1 1 1 - 1 1 - 2 2 2 2 2 -CCI - #23 - #23 - - #2 - #23 - #2 - | | Time step: 4 Available workers 16 Available Goods 5 Time step: 5 Available workers 16 Available Goods 5 CC-RRRRR- I-CC-RRRRR-CC IIIII-CC-11111-CCI CC - 2 2 2 2 2 - |1 1 1 1 1 0 - 2 3 3 3 2 - 12 3 2 1 - 2 2 - 333 33-CCI 12 311 - 22 - 2333 2 -10 # . - # - # - # # - | ] Time Step: 6 Available workers 19 Available Goods 5 config3.txt - Notepad File Edit Format View Help Region Layout:region3.csv Time Limit:15 Refresh Rate: 2 A B C D E F H 1 K L M N O P Q R 1 - - - - - - - - - - - 2 1 1 1 C R R R R R C 3 1 1 1 1 c C R R R R C 4 1 1 I c c R R R R R C 5 I I I - C R R R R R C 6 1 I 0 1 1 R R R R R 1 1 1 1 1 1 7 c C R R R R R C 8 I I I c - R R R R R 9 # - - # - # - - # - # - # # - 10 T T T T T P T T T T T T T T T T 11 12 13 Implementation Your program must provide the following functionality and adhere to the following constraints: . Your int main() should be in its own.c.cpp file All.c/.cpp files, except your main.c/main.cpp, must have associated header files. You may not #include a .c/.cpp file, only header files Allow the user to input the file containing the simulation configuration O DO NOT hardcode the filename into your program o The first line will provide the name of the file containing the region layout (DO NOT prompt the user for this filename) o The second line will provide the maximum amount of time steps the simulation can take o The third line will provide the refresh rate of how often the current state of the region should be output to the user during simulation Your system should perform the following operations: Read in and store the simulation configuration information O Read in and store the initial region layout The file will be in CSV format The region may be any sized rectangle The region contains O pollution at the beginning of the simulation . Rrepresents a residential zone Trepresents an industrial zone Crepresents a commercial zone - represents a road - Trepresents a powerline #represents a powerline over a road Prepresents a power plant o Output the initial region state - If a cell is zoned residential, industrial, or commercial and has a population of O, the letter representing the zone type should be displayed instead of its population The initial region state can be interpreted as time step 0 Simulate the development of the city over time The simulation should halt when there is no change between two, consecutive time steps or when the time limit has been reached, whichever comes first . The current time step, number of available workers, and number of available goods should be output for each timestep except time step 0 The state of the region should be output at the frequency denoted by the refresh rate in the configuration file The region is considered to be flat, and thus the edges do not wrap around to connect to each other Two cells are considered adjacent if they share an edge or corner (i.e. a cell may be adjacent to a maximum of eight other cells, and a minimum of three other cells) Each of the zoned cells will change their state according to the provided rules In the event of a decision needing to be made over two zoned cells that could grow and use available resources, the following rules must be used in order: 1. Commercial zoned cells are prioritized over industrial zoned cells ones 2. The growth of larger population zoned cells is prioritized over smaller population zoned cells (i.e. a 1 population cell will always grow before a 0 population cell) 3. The growth of zoned cells with greater total adjacent populations is prioritized over zoned cells with smaller total adjacent populations 4. The growth of zoned cells with smaller y coordinates is prioritized over zoned cells with greater Y coordinates, assuming the top left cell is 0,0 5. The growth of zoned cells with smaller X coordinates is prioritized over zoned cells with greater X coordinates, assuming the top left cell is 0,0 Residential If a cell has a population of O and is adjacent to a powerline in the current time step, that cell's population will increase by 1 in the next time step If a cell has a population of O and is adjacent to at least one cell with a population of at least 1, that cell's population will increase by 1 in the next time step If a cell has a population of 1 and is adjacent to at least two cells with a population of at least 1, that cell's population will increase by 1 in the next time step If a cell has a population of 2 and is adjacent to at least four cells with a population of at least 2, that cell's population will increase by 1 in the next time step If a cell has a population of 3 and is adjacent to at least six cells with a population of at least 3, that cell's population will increase by 1 in the next time step If a cell has a population of 4 and is adjacent to at least eight cells with a population of at least 4, that cell's population will increase by 1 in the next time step The residential population provides workers to the industrial and commercial zones, but each worker can only have one job Industrial If a cell has a population of O, is adjacent to a powerline in the current time step, and there are at least 2 available workers, that cell's population will increase by 1 in the next time step and the available workers are assigned to that job If a cell has a population of O, is adjacent to at least one cell with a population of at least 1, and there are at least 2 available workers, that cell's population will increase by 1 in the next time step and the available workers are assigned to that job 3 If a cell has a population of 1, is adjacent to at least two cells with a population of at least 1, and there are at least 2 available workers, that cell's population will increase by 1 in the next time step and the available workers are assigned to that job If a cell has a population of 2, is adjacent to at least four cells with a population of at least 2, and there are at least 2 available workers, that cell's population will increase by 1 in the next time step and the available workers are assigned to that job A cell produces pollution equal to its population, and pollution spreads to all adjacent cells at a rate of one less unit of pollution per cell away from the source The industrial population provides goods to the commercial zones, at a rate of one good per population, but each good can only be sold at one commercial cell . Commercial If a cell has a population of 0, is adjacent to a powerline in the current time step, there is at least 1 available worker, and there is at least one available good, that cell's population will increase by 1 in the next time step and the available worker and available good are assigned to that job If a cell has a population of O, is adjacent to at least one cell with a population of at least 1, there is at least 1 available worker, and there is at least one available good, that cell's population will increase by 1 in the next time step and the available worker and available good are assigned to that job If a cell has a population of 1, is adjacent to at least two cells with a population of at least 1, there is at least 1 available worker, and there is at least one available good, that cell's population will increase by 1 in the next time step and the available worker and available good are assigned to that job Output the final region state o Output the total, regional population for residential zones, industrial zones, and commercial zones o Output the final regional pollution state o Output the total pollution in the region Prompt the user for the coordinates of some rectangular area of the region to analyze more closely You must perform bounds checking to make sure the coordinates are within the bounds of the region, and reprompt the user if their coordinates are outside the bounds o Output the total population for residential zones, industrial zones, and commercial zones within the area specified by the user Output the total pollution within the area specified by the user See the example output files for formatting of each of the outputs Major functionality components must be constructed in some function, or across some functions, that are declared and defined outside of your main.c/main.cpp. Remember, function declarations must be stored in a header file, while definitions must be stored in a.c/.cpp file. You may have additional functions that support your major functionality component function. Your code must be well commented. Each group member should be performing regular commits to the GitLab repository on the Apollo server with meaningful commit messages. "Fixed bug" or "New code" are not meaningful, so try to be more specific about what was fixed or what was added. Please do not commit the example input and output files to the remote server as that may cause a space issue on the server. Beginning simulation Please enter the name of the configuratipn file:Initial Region State RRRRR CC-RRRRR-CC III-CC-RRRRR-CC | IIIII-CC-RRRRR-CCI II-CC-RRRRR-CCI III-CC-RRRRR-CCI III-CC-RRRRR-CCI - # - # - - # - # - # - # - 1 | Time Step: 1 Available Workers 5 Available Goods - CC-RRRRR-CC I-CC-RRRRR-CCI II CC-RRRRR-CCI CC-RRRRR-CCI |IIII-CC-RRRRR-CCI |IIII-CC-RRRRR-CCI |IIII-CC-11 111-CCI # # - # - # | | Time Step: 2 Available workers 9 Available Goods 2 Time step: 3 Available Workers 13 Available Goods 3 C-RRRRR-CC I-CC-RRRRR-CC! II-CC-RRRRR-CC | II CC-RRRRR-CC IIIII-CC-11 111-CC! |1 1 1 1-CC-2 2 2 2 2 -CCI 1 1 1 1 - 1 1 - 2 2 2 2 2 -CCI - #23 - #23 - - #2 - #23 - #2 - | | Time step: 4 Available workers 16 Available Goods 5 Time step: 5 Available workers 16 Available Goods 5 CC-RRRRR- I-CC-RRRRR-CC IIIII-CC-11111-CCI CC - 2 2 2 2 2 - |1 1 1 1 1 0 - 2 3 3 3 2 - 12 3 2 1 - 2 2 - 333 33-CCI 12 311 - 22 - 2333 2 -10 # . - # - # - # # - | ] Time Step: 6 Available workers 19 Available Goods 5 config3.txt - Notepad File Edit Format View Help Region Layout:region3.csv Time Limit:15 Refresh Rate: 2 A B C D E F H 1 K L M N O P Q R 1 - - - - - - - - - - - 2 1 1 1 C R R R R R C 3 1 1 1 1 c C R R R R C 4 1 1 I c c R R R R R C 5 I I I - C R R R R R C 6 1 I 0 1 1 R R R R R 1 1 1 1 1 1 7 c C R R R R R C 8 I I I c - R R R R R 9 # - - # - # - - # - # - # # - 10 T T T T T P T T T T T T T T T T 11 12 13

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Watson Watson

5th Edition

0471715360, 978-0471715368

More Books

Students also viewed these Databases questions

Question

Explain the causes of indiscipline.

Answered: 1 week ago

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago