Question: Visual C# Exercise 8.21 (Turtle Graphics) The Logo language made the concept of turtle graphics famous. Imagine a mechanical turtle that walks around the room

Visual C# Exercise 8.21 (Turtle Graphics) The Logo language made the concept of turtle graphics famous. Imagine a mechanical turtle that walks around the room under the control of a C# app. 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, and while the pen is up, the turtle moves about freely without writing anything. In this problem, you'll simulate the operation of the turtle and create a computerized sketchpad. Use a 20-by-20 rectangular array floor that's initialized to 0. Read commands from an array that contains them. Keep track at all times of the current position of the turtle 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 move to the right by default. The set of turtle commands your app must process are: (Commands: 1 means Pen Up, 2 means Pen Down, 3 is turn right, 4 is turn left; 5, 10 means move forward 10 spaces (replace 10 for a different number of spaces); 6 means display the 20-by-20 array, 9 means end of data (sentinel).

Suppose that the turtle is somewhere near the center of the floor. The following "app" would draw and display 12-by-12 square, leaving the pen in the up position:

2

5, 12

3

5, 12

3

5, 12

3

5, 12

1

6

9

As the turtle moves with the pen down, set the appropriate elements of array floor to 1s. When the 6 command (display the array) is given, wherever there's a 1 in the array, display an asterisk or any character you choose. Wherever there's a 0, display a blank.

Write an app to implement the turtle graphics capabilities discussed here. Write several turtle graphics apps to draw interesting shapes. Add other commands to increase the power of your turtle graphics language. (Console app)

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!