I'd like to make a simple drawPolygon script that needs two inputs, one of length of each side and one for number of sides.
The basic prototype is: drawPolygon (length, sides): repeat sides forward length turn sides/360 With Etoys, It looks like the limit is one input parameter for a script, so that the script would be limited to: drawPolygon (sides): repeat sides forward 100 <-- the user would need to hard code the length of the sides turn sides/360 Can I use more than on numerical input in a script? Thanks, Randy Latimer _______________________________________________ squeakland mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/squeakland |
note that drawPolygon should be "turn 360/sides" (below)
On Wed, Aug 31, 2011 at 11:41 AM, R.D. Latimer <[hidden email]> wrote: I'd like to make a simple drawPolygon script that needs two inputs, one of length of each side and one for number of sides. _______________________________________________ squeakland mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/squeakland |
Randy,
Perhaps this project is a partial answer to your questions below: http://etoysillinois.org/library?sl=1630 Kathleen From: [hidden email] [[hidden email]] on behalf of R.D. Latimer [[hidden email]]
Sent: Wednesday, August 31, 2011 11:01 AM To: [hidden email]; Allard, Fred Subject: Re: [squeakland] More than one input for a script? note that drawPolygon should be "turn 360/sides" (below)
On Wed, Aug 31, 2011 at 11:41 AM, R.D. Latimer
<[hidden email]> wrote:
I'd like to make a simple drawPolygon script that needs two inputs, one of length of each side and one for number of sides. _______________________________________________ squeakland mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/squeakland |
In reply to this post by R.D. Latimer
Yes, you are limited to one parameter per message send in Etoys.
You can set the length variable before the message send. Not as functional but works very well. Karl
On Wed, Aug 31, 2011 at 5:41 PM, R.D. Latimer <[hidden email]> wrote: I'd like to make a simple drawPolygon script that needs two inputs, one of length of each side and one for number of sides. _______________________________________________ squeakland mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/squeakland script.jpeg (66K) Download Attachment |
In reply to this post by Harness, Kathleen
When teaching "drawing polygons/40 mathematical shapes challenge" I usually have kids draw a triangle, then a square, then a pentagon. I then ask them to look at the three scripts they used to draw these shapes and ask what they notice about them, what is the same and what is different?
They usually pick up on the only difference is the turn value and length values. I then introduce them to variables and ask them to create "one script to rule them all" Which usually leads to an aha and cool moment.
I like the Etoys challenge method of introducing this where the scripting tiles for "repeat", "turn by" and "forward by" are on the playfield. An excellent introduction to this is to have the kids program themselves before they program the computer. I sometimes start off by having them program me to "walk a square". Then when the say "turn" or "turn right" I turn by a non 90 degree amount or make a complete 360 degree turn, which usually invites giggles and "No that's not what I meant" Then I talk about the importance of using specific language. After they program me and have that experience I ask them to program each other. You can use sidewalk chalk as the pen as well.
The Scratch team had a great idea where they made "cards" (on 8.5 x 11 pieces of paper/card stock) with different scripting tiles the the kids could use to create the "program".
Stephen
On Wed, Aug 31, 2011 at 12:09 PM, Harness, Kathleen <[hidden email]> wrote:
_______________________________________________ squeakland mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/squeakland |
In reply to this post by Harness, Kathleen
Randy,
Moving covnersation to squeakland list so others can comment. See my comments below on your latest email. A lot of what I believe you are trying to do in Etoys (based on your example NetLogo script) can be done, but it needs a seperate email to respond.
Stephen
On Fri, Sep 2, 2011 at 11:02 AM, Avigail Snir <[hidden email]> wrote:
Most likely to maintain simplicity would be my guess.
What you say makes sense for functional programming languages. Etoys was inspired by Alan Kay's work on the Dynabook and smalltalk and thus was designed to be object oriented. Now Alan's definition of object oriented is very different from the common understanding, I would highly recommend Alan's talk at HPI . Etoys is built on first principles with the goal of being able to build "anything" from a small set of first principle objects.
Etoys uses the concept of a collection which is more powerful than the Scratch and BYOB use of lists in that anything can be in a collection. You can use a Holder (which is a specialized version of a playfield) to iterate through objects (holders, books, pages and world are all specialized versions of playfield which support the collection category).
That said you also have the full power of sqeuak underneath. Simply click on the menu icon in the script editor and click "show code textually" and you can see the Squeak version of the code. Unfortunately the translation is only one way you can go from tiles to text, but not text to tiles.
Check this thread from the squeakland mail list which discusses playing musical notes in Etoys. Bert has a nice solution and shows the script and use of a Holder.
_______________________________________________ squeakland mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/squeakland |
Free forum by Nabble | Edit this page |