Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

input files: pokefruit_palletfarm.txt 4 0,0 0,3 3,0 3,3 pokefruit_celadonfarm.txt 5 0,2 2,0 4,2 2,4 pokefruit_pewterfarm.txt 5 1,2 2,1 3,2 2,3 pokefruit_saffronfarm.txt 100 30,16 32,49 34,18

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

input files:

pokefruit_palletfarm.txt

4 0,0 0,3 3,0 3,3

pokefruit_celadonfarm.txt

5 0,2 2,0 4,2 2,4

pokefruit_pewterfarm.txt

5 1,2 2,1 3,2 2,3

pokefruit_saffronfarm.txt

100 30,16 32,49 34,18 34,32 36,37 33,33 33,37 17,18 42,26 19,21 23,21

pokefruit_viridianfarm.txt

7 0,3 5,5 6,0 1,3 6,6 5,1 3,3

Thanks in advance!

Problem Description Pokemon are fantastic creatures that people can catch and train, and many Pokemon trainers aspire to catch as many as possible. Imagine that you have caught so many Pokemon that you have decided to acquire your own farm to feed them. Your farm is an NrN plot of fruit trees, and there are potentially five different types of fruits that can grow on the farm: firefruits, waterfruits, grassfruits, joltfruits and the very rare megafruit. Initially, your farm is mostly empty, with just a few fruit trees placed here and there. However, each spring the fruit trees will spread to adjacent locations in the farm (using a process described further below). Each fall, you will harvest the different types of fruit from all of the trees on your farm. Your task for this assignment is to write a prog report the total fruit yield by the time the farm is done growing ram that will simulate the growth of your farm over time and Problem Details Initial conditions We will visualize the farm as an NrN grid of characters, where an underscore () represents an empty space for a fruit tree, and a letter represents a fruit tree of the corresponding type (F for firefruit tree, W for waterfruit tree, etc... The initial conditions for the farm will come from a file so you will have to do some file input to set up your farm. Be careful: the file format for the input file will NOT look like the visualization of the farm just described), but will instead be much more compact. It will look like this: 0,0 1, 0 2,0 3,0 0,3 1,3 2,3 3,3 The first line of the file is a single integer indicating the dimensions of the farm (the farm is always square) This is followed by exactly 4 more lines, one line for each type of basic fruit tree in this order. firefruit, waterfruit, grassfruit joltfruit. On each line will be one or more sets of (row.column) coordinate pairs rep- resenting the intial locations of the fruit trees. The coordinate pairs on the same line are separated from each other by spaces and the row and column for each pair are separated by a comma. Below is a visual ization of the farm that is represented by the input file above. Make sure you understand how the input file matches up to the grid picture before going any further! Some might even say they gotta catch them all Problem Description Pokemon are fantastic creatures that people can catch and train, and many Pokemon trainers aspire to catch as many as possible. Imagine that you have caught so many Pokemon that you have decided to acquire your own farm to feed them. Your farm is an NrN plot of fruit trees, and there are potentially five different types of fruits that can grow on the farm: firefruits, waterfruits, grassfruits, joltfruits and the very rare megafruit. Initially, your farm is mostly empty, with just a few fruit trees placed here and there. However, each spring the fruit trees will spread to adjacent locations in the farm (using a process described further below). Each fall, you will harvest the different types of fruit from all of the trees on your farm. Your task for this assignment is to write a prog report the total fruit yield by the time the farm is done growing ram that will simulate the growth of your farm over time and Problem Details Initial conditions We will visualize the farm as an NrN grid of characters, where an underscore () represents an empty space for a fruit tree, and a letter represents a fruit tree of the corresponding type (F for firefruit tree, W for waterfruit tree, etc... The initial conditions for the farm will come from a file so you will have to do some file input to set up your farm. Be careful: the file format for the input file will NOT look like the visualization of the farm just described), but will instead be much more compact. It will look like this: 0,0 1, 0 2,0 3,0 0,3 1,3 2,3 3,3 The first line of the file is a single integer indicating the dimensions of the farm (the farm is always square) This is followed by exactly 4 more lines, one line for each type of basic fruit tree in this order. firefruit, waterfruit, grassfruit joltfruit. On each line will be one or more sets of (row.column) coordinate pairs rep- resenting the intial locations of the fruit trees. The coordinate pairs on the same line are separated from each other by spaces and the row and column for each pair are separated by a comma. Below is a visual ization of the farm that is represented by the input file above. Make sure you understand how the input file matches up to the grid picture before going any further! Some might even say they gotta catch them all

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

Students also viewed these Databases questions