Answered You can hire a professional tutor to get the answer.

QUESTION

Description: The Logo language, which is popular among elementary school children, made the concept of turtle graphics famous.

Description:The Logo language, which is popular among elementary school children, made the concept of turtle graphics famous. Imagine a mechanical turtle that walks around the room under the control of a C++ program. The turtle holds a pen in one of two positions, up or down. While the pen is down, the turtle traces out shapes as it moves; while the pen is up, the turtle moves about freely without writing anything. In this problem, you will simulate the operation of the turtle and create a computerized sketchpad as well.Use a N-by-M dynamic data structure called “floor” that is initialized to zeros (You can use a dynamic 2D array or one that we will talk about). The layout is as follows:(0,0) … (M,0)…(0,N)…(N,M)Read commands from an array that contains them. Keep track of the current position of the turtle at all times and whether the pen is currently up or down. Assume that the turtle always starts at position (0,0) of the floor with its pen up and is headed down (south). The set of turtle commands your program must process are given below:Command Meaning-------------------------Pen upPen downTurn right (with respect to his current orientation)(with respect to his current orientation)5,10 Move forward (10 spaces in this case)Print the 20-by-20 arrayEnd of data (sentinel)Directions-------------------------NorthEastSouthSuppose that the turtle is somewhere near the center of the floor. The following “program” would draw and print a 12-by-12 square and end the with pen in the up position:25,1235,1235,1235,12169As the turtle moves with the pen down, set the appropriate elements of “floor” to 1’s. When the 6 command (print) is given, wherever there is a 1 in the floor, display an special character. Wherever there is a zero, display a blank.Some requirements (for full credit, of course):Use the console graphics lite code from our book to render the board and turtle position.The turtle cannot go outside of the boundary. Error check!! Use a special exception class you create called TurtleGraphicsException to throw exceptions.Create a class called TurtleGraphicsDriver as your “driver” program. Main() should be very small!!!!Create a class called TurtleGraphics to handle the board and turtle.Any other classes you can think of? How about inheritance? Would a Turtle class make sense?Make your turtle graphics driver interactive (e.g. “Enter a command:” with a do-while loop), BUT, you must also be able to accept a list of commands from a text file that your driver reads in and runs. This is called a script.Add other commands that you think would be cool.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question