By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,678 Members | 1,146 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,678 IT Pros & Developers. It's quick & easy.

Turtle Graphics

P: 2
I saw this program from a website... Any solution ?

Turtle Graphics: The Logo language, which is particularly popular among personal computer user, made the concept of turtle graphics famous. Imagine a mechanical turtle that walks around the room under control of c++ program. The turtle holds a pen in one of the 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 freely without writing anything. In this problem, you will simulate the operation of the turtle and create a computer sketchpad as well.
Use a 20-by-20 array floor that is initialized to zeros. Show movement of the turtle with pen down by marking #. The turtle always starts from 0,0. The set of turtle commands is as shown for printing a 12 X 12 square is shown below
2
5, 12
3
5,12
3
5,12
1
6
9
The meaning of the command can be followed from the table shown below

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 20 by 20 array
9 End of data


Write a c++ program to read the turtle command from a file and implement the turtle capabilities discussed here. Add other commands if required.
Sep 27 '07 #1
Share this Question
Share on Google+
4 Replies


Expert 100+
P: 671
It's a common beginner type problem. Did you have an actual question?
Sep 27 '07 #2

P: 2
Any code for this question ?
Sep 27 '07 #3

Expert 10K+
P: 11,448
Any code for this question ?
We're all staring in anticipation in your general direction because your assignment
wants you to produce that little application. When you're stuck with some particular
details we most likely can help you out.

kind regards,

Jos
Sep 27 '07 #4

P: 1
Well i got a question. I have the same exercise in java and my only question is how are we gonna read the comma seperated values( in the case of the command 5,10 that is)..Thanks in advance! :D
Jul 11 '10 #5

Post your reply

Sign in to post your reply or Sign up for a free account.