Question: (Turtle Graphics) The Logo language, which is popular among young computer users, made the concept of turtle graphics famous. Imagine a mechanical turtle that walks
(Turtle Graphics) The Logo language, which is popular among young computer users, made the concept of turtle graphics famous. Imagine a mechanical turtle that walks around the room under the control of a JavaScript program. The turtle holds a pen in one of two positions, up or down. When the pen is down, the turtle traces out shapes as it moves; when the pen is up, the turtle moves about freely without writing anything. In this problem, youll simulate the operation of the turtle and create a computerized sketchpad as well.Use a 20-by-20 array floor thats initialized to zeros. Read commands from an array that contains them. Keep track of the current position of the turtle at all times and of 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. Suppose that the turtle is somewhere near the center of the floor. The following program would draw and print a 12-by-12 square, then leave the pen in the up position: 2,5,12,3,5,12,3,5,12,3,5,12,1,6,9 Assume that the turtle always starts facing right at position 0,0 (upper left hand corner) of the floor with its pen up. The set of turtle commands your program must process are as follows: Command Meaning 1 Pen up 2 Pen down = "*" 3 Turn right 4 Turn left 5,10 Move forward 10 spaces (or a number other than 10) 6 Print the 20-by-20 array 9 End of data (sentinel)
I need a javascrpt/HTML program for this.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
