Ring of People
LOGO and Java
The ring to the left is a bitmap image created using MswLogo and MSPaint. The ring to the right is a Java applet. The ring to the left was easy to make. The ring to the right was a bit more challenging. It even involved the use of sine and cosine functions.
This example should illustrate that some things are easier to do well with simpler tools. The MswLogo/MsPaint combination was easier to use and it produced better results. To get the thick line effect with Java is definately possible, but it would be a lot more trouble.
Assignment: You will simply produce a ring of stick people like either of the above illustrations. To do this in Logo I used the edit command to make a function called person. That way I could just write a line like "repeat 18[pd person pu fd 5 rt 20]" to make the ring of people. The problem is that I also used the xcor, ycor, and heading commands to make the job easier. I also created variables to store this information. (To create variables you simply use the make command.) [You can read up on all this stuff if you want to, but it will be explained in upcoming lessons anyways. So, for now you'll have to do this assignment the old fashioned way... one person at a time!]
Click here to see the new and improved
Ring of Java People Applet (it has thicker lines)!!!

I won't be giving anything away if I let you see the Java code which
created the Java version of the ring of people. So here it is:

import java.awt.*;
import java.applet.*;

public class ring extends Applet {
  Color funnyGreen;

  public void init() {
    setBackground(Color.magenta);
    funnyGreen= new Color(55,255,0);
  }

  public void paint(Graphics g) {
    g.setColor(funnyGreen);
    int x;
    int y;
   for(int i=0;i<360;i+=18)
   {
    x=(int)(90*Math.cos(i*Math.PI/180)+size().width/2);
    y=(int)(90*Math.sin(i*Math.PI/180)+size().height/2-10);
    g.drawOval(x-5,y-2,10,10);
    g.drawLine(x,y+10,x,y+18);
    g.drawLine(x-12,y+12,x+12,y+12);
    g.drawLine(x,y+18,x-9,y+26);
    g.drawLine(x,y+18,x+9,y+26);
   }
  }
}