Results 1 to 2 of 2

Thread: turtle graphics

  1. #1
    Kareem Mesbah is offline Member
    Join Date
    Sep 2012
    Rep Power

    Default turtle graphics

    Hi, please check this exercise
    The Logo language made the concept of turtle graphics famous. Imagine
    a mechanical turtle that walks around the room under the control of a Java application. The turtle
    holds a pen in one of two positions, up or down. While the pen is down, the turtle traces out shapes
    as itmoves, 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 array floor that’s initialized to zeros. 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. The set of turtle commands your application must process are shown in the following

    Command Meaning
    1 Pen up
    2 Pen down
    3 Turn right
    4 Turn left
    5,10 Move forward 10 spaces (replace 10 for a different number of spaces)
    6 Display the 20-by-20 array
    9 End of data (sentinel

    Suppose that the turtle is somewhere near the centre of the floor. The following “program”
    would draw and display a 12-by-12 square, leaving the pen in the up position:
    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 application to implement the turtle graphics capabilities discussed here.Write several
    turtle graphics programs to draw interesting shapes. Add other commands to increase the power of
    your turtle graphics language.

    I'd created a two dimensional array floor and initialized its elements to zeros. but my brain stopped working :-s I guess I need to create methods turnRight and turnLeft but actually I need more hints that help me give these two methods the effective functionality. so can you provide me with more hints please ?

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

    Default Re: turtle graphics

    What does your question have to do with Java?

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Replies: 1
    Last Post: 12-09-2011, 01:18 PM
  2. Drawing a graphics onto another Graphics ?
    By Ziden in forum Java Applets
    Replies: 0
    Last Post: 01-08-2011, 07:30 PM
  3. Downloading Turtle Graphics and Other Packages
    By Godsarmy4vr2 in forum New To Java
    Replies: 4
    Last Post: 02-28-2010, 06:19 PM
  4. need help with "turtle" problem
    By cbear315 in forum New To Java
    Replies: 4
    Last Post: 09-18-2009, 01:23 AM
  5. Turtle assignment
    By jmc724 in forum New To Java
    Replies: 11
    Last Post: 07-16-2008, 09:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts