learn floor $value {
$rounded = round $value
$diff = $value - $rounded
if $diff >= 0 {
return $rounded
}else{
return $rounded - 1
}
}
This implementation is of course far from optimal. Maybe I'll consider adding it as a core command together with 'ceil'.
I don't fully understand what your proposed arc command should do. But things like drawing circles can already be done (using simple forward and turnleft/turnright commands). So I think that, given enough calculations, any arc can be drawn.
Array functionality has been discussed a couple of times among the developers. It would involve quite a bit of work to make the current KTurtle interpreter work with arrays and I believe the discussion concluded that we think arrays are too advanced to fit in KTurtle. Maybe this will change in the future, but for now (and the near future) you won't see arrays in KTurtle.
Regards,
Niels
--
You received this message because you are subscribed to the Google Groups "KTurtle; an educational programming environment" group.
To post to this group, send email to kdeedu-...@googlegroups.com.
To unsubscribe from this group, send email to kdeedu-kturtl...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/kdeedu-kturtle?hl=en.
learn arc $radius, $angle {
$angle_i = arccos 1/$radius
$angle_e = 90 - $angle_i
$n = round $angle/(2*$angle_e)
turnright 90
repeat $n {
turnleft 2*$angle_e
forward 2
}
}
Since circumference is a pretty basic geometric form normally drawn using the radius measurement and it is not so simple to implement it, i think it would be really nice do have the function in core.
What do you think?
About the array, OK. I can imagine it is not so simple to implement it.
Regards,
Leo
Hi Neils,
Exactly! The function ceil is quite similar. Another equivalent option is implement the function "remain of a division", maybe this last one is even more useful and versatile to include in the core.
About the arc command, I know that is easy to build a "generic" circle using forwards and turns, but it is not trivial to do it for a known radius if you considere young students that dont know trigonometry. The above code is my sugestion:
learn arc $radius, $angle {
$angle_i = arccos 1/$radius
$angle_e = 90 - $angle_i
$n = round $angle/(2*$angle_e)
turnright 90
repeat $n {
turnleft 2*$angle_e
forward 2
}
}
Since circumference is a pretty basic geometric form normally drawn using the radius measurement and it is not so simple to implement it, i think it would be really nice do have the function in core.
What do you think?
"I think the list of commands in KTurtle should be a minimal set. Part of the fun of logo it that you have to implement your own triangle and rectangle functions. If something can be implemented trivially using the basic commands, then I see no reason to add the functionality as a basic command.
"Maybe we can start some sort of KTurtle standard library? Like a bunch of functions implemented in KTurtle script that might be usable for others as well. I'm not sure how we make it available to users (maybe as scripts on kde-apps.org, maybe something different), but I would prefer that over implementing more functions as KTurtle core functions."
kturtle is a subset of logo, which is a very sophisticated language. the inventors of logo had hoped it wd become a much-employed application language. i think ucblogo is the original version of it. details at: http://www.cs.berkeley.edu/~bh/logo.html.
--
You received this message because you are subscribed to the Google Groups "KTurtle; an educational programming environment" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kdeedu-kturtl...@googlegroups.com.
Visit this group at http://groups.google.com/group/kdeedu-kturtle.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to kdeedu-kturtl...@googlegroups.com.
To post to this group, send email to kdeedu-...@googlegroups.com.
Visit this group at http://groups.google.com/group/kdeedu-kturtle.
For more options, visit https://groups.google.com/d/optout.