Sometimes, storing an image is easier if you store the steps taken to draw the image rather than the image itself. In such a situation, a sequence of directed lines are concatenated, or attached to one another, to form the image. For example, a simple drawing program might allow eight simple directions of movement:
8 1 2
7 3
6 5 4
[The arrows didn't copy but the (4-8)(6-2)diagonals and (7-3)horizontal, (5-1)vertical lines]
For this example, a “picture” composed of the sequence “1, 3, 4, 3” would draw a line segment up, to the right, down on an angle, then right again.Develop a program to take an encoding sequence of numbers and create a drawing based on the sequence, using the arrow directions displayed in the first figure. Your program must use the text screen for the drawing surface and must allow for a figure up to 20 characters tall and 70 characters wide. Your drawings on this grid should be made with the asterisk (*) character. Each drawing must start in the lower-left corner and if a command would have the figure move “off the page,” the program must ignore that command and proceed on to the next command in the sequence.
Each encoded sequence entered will be a list of numbers, positive and/or negative, ending with a 0 as the indicator that the drawing is finished. If the number is negative, you must move in the direction you would if the value were positive, but you do not put an asterisk in the position when done moving. Sequences may be of any length. After inputting the zero value, your program will display the final image.
To get full credit on this assignment you must use a class and objects for image processing. You must use an array to store and print the character sequence onto the screen. (A 2 dimensional array would be ideal.) Please do as much code as you can in your class and leave main() as small as possible. You should have a 2 dimensional array inside of your class along with some sort of int values for the x and y coordinates to keep track of what array elements you are going to store the user inputted image.
Sample Run:
Enter drawing sequence below.1 1 1 2 2 4 4 5 5 7 7 7 0
Your picture:
*
* *
* *
* *
*****
------------------------------------------------------------------------------
so this assignment is a bit weird to me, I would like to know how to make the grid for the commands to navigate the "draw" part.
I get an awesome grade in this course thus far. I just need help starting off.
Are we going to be making the grid in an class/object
and draw navigation be another object.
Usually I make a flowchart for my programs and it doesn't seem that I can figure out how to do this that way.