Make your own free website on Tripod.com

JLogo: Implementing Logo using Java.


 !   

The simple classes: CoOrds, OrderedCoords and Turtle.

This is the whole of CoOrd.java
public class CoOrds{
public int x;
public int y;
public CoOrds(int xx,int yy){x=xx;y=yy;}
public String toString(){
String s="["+x+","+y+"]";
return s;
}
}
That’s all. Yeah that’s it. So it is nothing but a placeholder for a point.

The class OrderedCoOrds implements the idea of line. It has two CoOrds(points) between which the line will be drawn. It also has attribute color telling which color the line be drawn in.
public class OrderedCoOrds{
public CoOrds first;
public CoOrds sec;
public Color color;
……………
The class Turtle has position, orientation and status of the pen. It has getter and setter for these variables.
public class Turtle{
public int xPos;
public int yPos;
public int orien;
public short pen;
…………


to next chapter >>>