|
|
The Development of JLogo.
For many people Logo is the first programming language learnt. Here we
will see how to implement a subset of Logo using Java. For those of you
who have never come across Logo, it is a language which allows you to
draw line drawings by giving commands. Here is what your finished product
will look like.
Attacking the problem.
In logo we will need to take input from the user. This input will be in
form of Logo commands, like fd 10 or forward 10. Then we need to convert
these commands into a format which our program can understand. Also we
will need to have a GUI element implementing our custom drawing for Logo.
We also need to have a file tying all the logic together and showing the
GUI.
Lets see the classes we are going to use.
SwingWorker.java and UtilityWorker.java: These classes convert the users
input to a format which our Program can understand and draw.
DrawArea.java: This class implements our custom drawing, and draws itself
according to the instructions given.
Logo.java: This ties together all the logic.
We also have three more classes, CoOrd.java and OrderedCoOrds.java. These
are simple classes which we will use to implement the idea of points and
lines. We have a class Turtle to model the turtle which moves on and draws.
It has two ints telling the point the turtle is at, an int telling the
current orientation and a short which holds the status of the pen.
to next chapter >>>
|