Question: #C coding. NOT java NOR C++. only C coding Bouncy String You are tasked to write a program that will take in parameters from command

#C coding. NOT java NOR C++. only C coding

Bouncy String

You are tasked to write a program that will take in parameters from command line (argv). These parameters are a Word, Starting Position and the Number of Iterations. The program requires the index to move from the starting position (going right first) to the boundary and then going in reverse until the number of iterations have been met.

The arguments are assumed to be in this order: word starting_position iterations

./bouncy_string BouncyString 2 15 

Example 1, word="BouncyString", start=0, n=15

BouncyStringnirt 

Example 2, word="SomeString", start=4, n=15

StringnirtSemoS 

Example 3, word="SomeString", start=4, n=0

S 

Example 4, word="BouncyString", start=-1, n=15

Invalid start position 

Example 5, word="BouncyString", start=1, n=-1

Invalid iteration count 

Example 6, start=1, n=-1

Invalid arguments length 

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Where can I go!

You are tasked with writing a program that will display where a character can move on the gameboard. The gameboard will be specified by width and height. You do not need to display any other attribute on the board besides the character which is denoted by C in the grid space and how many spaces they can move after they have moved to that position.

The character has a starting position which is denoted by x and y as well as a walk limit.

If the character cannot reach the grid space than it should be a space

| | 

if the the character can reach the grid space, than it should display how many gridspaces they can still move. In the example, if the character had a walk limit of 7 and could move 5 grid spaces they can only move another 2 spaces from that space

|2| 

Input is from command line arguments (argv), you will need to distinguish if the input is also a valid integer.

The arguments are assumed to be in this order width height x y walk_limit

./movement 4 4 1 3 2 

Example Case 1, width=4, height=4, x=1, y=3, limit=2:

./movement 4 4 1 3 2 

+-------+ | | | | | | |0| | | |0|1|0| | |1|C|1|0| +-------+ 

Example Case 2, width=4, height=4, x=1, y=3, limit=1:

./movement 4 4 1 3 1 

+-------+ | | | | | | | | | | | |0| | | |0|C|0| | +-------+ 

Example Case 3, width=5, height=4, x=1, y=3, limit=5:

./movement 5 4 1 3 5 

+---------+ |1|2|1|0| | |2|3|2|1|0| |3|4|3|2|1| |4|C|4|3|2| +---------+ 

Example Case 4, width=6, height=5, x=1, y=4, limit=5:

./movement 6 5 1 4 5 

+-----------+ |0|1|0| | | | |1|2|1|0| | | |2|3|2|1|0| | |3|4|3|2|1|0| |4|C|4|3|2|1| +-----------+ 

Example Case 5, width=-1, height=5, x=1, y=4, limit=5:

./movement -1 5 1 4 5 

Invalid Width 

Example Case 6, width=5, height=-1, x=1, y=4, limit=5:

./movement 5 -1 1 4 5 

Invalid Height 

Example Case 5, width=5, height=5, x=-1, y=4, limit=5:

./movement 5 5 -1 4 5 

Invalid Character Properties 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!