Well, it is difficult to comment, specially since I have not helped
Niels with it. I like the idea of multiple turtles very much, and I
think it helps fullfill KTurtle's mission, by making it more interesting
to young students. We can couple it with a new command to let people set
the turtle's sprite art (via svg files) and suddenly a lot of
opportunities will open up, even with small games and things like that.
But I do not think using dot syntax helps here. I would prefer to keep
it procedural. So we would not loose the work Niels did to support
multiple turtles in the canvas area, but I was thinking about two new
commands: one to create a new turtle, and another to start "speaking" to
it. The canvas class would keep a pointer to the current turtle, and
almost no additions or changes to the language would be needed. There
would be no object types or changes to the interpreter, only two or
three new commands. So it would be something like:
//operating on the main (default) turtle
forward 100
turnleft 30
//the next line creates a new turtle and gives it a name
createturtle "daisy"
talkto "daisy"
forward 100
turnleft 30
//we need to define a name for the default turtle,
// here I called it simply turtle
talkto "turtle"
turnright 10
forward 10
talkto "daisy"
backward 10
hide
In this mode, the "show" and "hide" commands will simply operate on the
turtle we are currently talking to, no changes needed.
Optionally, we could add a command to remove a turtle, but I do not
think it is really necessary, as we could simply hide it. If we want
one, it could be
removeturtle "daisy"
For all the other commands (pen for example) we could take two routes:
keep different states for each turtle, or keep a global canvas state. I
would prefer to keep it global, as it is more procedural to me, but both
could be handled more or less easily without changes in the language or
interpreter, only keeping states in the canvas class for each turtle.
The other command I was thinking about in the past was one to change the
svg element or image, and coupled with this ability to talk to multiple
sprites we could implement small games and animations. I was thinking
about a
setImage "bird"
function that would operate on the current turtle. With it (and the
talkto or tell command) we could do something like is described in the
Up and Away section at the bottom of this page:
http://el.media.mit.edu/logo-foundation/logo/turtle.html
I think something like this still keeps the procedural model pretty much
in check, while expanding the features of the program a little bit and
adding several new dimensions for teachers to exercise.
But there are two separate issues. Anywasy, I can volunteer to work a
little bit on it for 4.3, specially if we take this route where most of
the work is concentrated on the canvas and QGV, as my grasp of the
interpreter is not good enough to work on stuff like implementing new
object types :) I leave these more complex bug fixes to you guys!
Best regards,
Mauricio Piacentini
forward 200
createturtle "niels"
talkto "niels"
forward 50
Woohoo!! Very cool, Niels! I would see if I can help with designing a
way to store the turtle state in the canvas. And what would be the name
of the default turtle? Or we just use talkto "turtle" ? Maybe talkto
"cies" could be included as an easter egg? :)
Regards,
Mauricio Piacentini
I am not sure if it is easier for children to remember the index of each
turtle or to call them by name. Some research using similar languages
shows that some use indexes, while others use names. The ones that use
indexes do not usually require a create command, you just start talking
to the other turtles, for example
talkto 1
show
...
talkto 0
So no need to create them. Our code could be easily adapted for this, by
checking if a given turtle exists, and if not creating it. These
languages usually have a limit for the number of turtles, around 1024.
Another approach is to create the sprite using a command. There are
several implementations for this, using variations of:
NEWTURTLE
CREATESPRITE
SETSPRITE
But if we really want to keep it dead simple, maybe just document that
internally we have up to 1024 turtles, and only the first one is shown
by default. To use the others, just
TALKTO 1
SHOW
and here you go. So no concept of "creation" of objects, and no explicit
turtle in the command.
>
> buttt... i think there is more important features to implement for kturtle:
> - contextual help still not in
> - errors tab could get some beautification (like spacing the errors
> table nicely)
> - contextual error help would be a killer
> - maybe even the variables tab should have contextual help
> (so it is integration with the help system where is see most low
> hanging fruit for making steps towards kturtle 'goal' of making
> programming something dead easy to start with)
Yes, this would be really useful.
> besides that we have some bugs piling up...
>
> the big change is in the interpreter though -- i would love to have a
> generated parser, and if i look at the design of KJS i see many room
> for improvement on the interpreter side (the ruby i wrote for
> definitions.rb is, ehhh, not the prettiest to say the least). the main
> thing we have to do _before_ the interpreter can get an other big
> cleanup:
>
> unittest
>
>
> that are the priorities the way i see 'm..
>
> dont worrie KTurtle is a free software project -- together with make
> kturtle's future, so if you have a different idea about the priorities
> for future development of kturtle, please post it here :-)
I am not really an expert in computer languages or interpreters, so my
ability to help here is a bit limited... I can see also that some
features (like implementing SETSHAPE to change the turtle graphics)
would open up a lot of new potential, but also several new problems. It
has to be done in a way that does not affect the portability of code,
for example. I will write a proposal for it.
Regards,
Mauricio Piacentini