|
E-Toys and Morphic for simple point plotting exercise?: msg#00087lang.smalltalk.squeak.beginners
I'd like to challenge some students (9 years old to 14 years old) to use Squeak to draw a Sierpenski Gasket (http://en.wikipedia.org/wiki/ Serpinski_gasket) as an experiment with random numbers. To draw something like you see at (http://commons.wikimedia.org/wiki/ Sierpinski_triangle), one method is to pick a starting point, randomly select one of the three fixed corners, plot a line half way there and repeat from each new position. I can seem to accomplish this awkwardly using E-Toys as follows: - draw a sketch morph using paint tool or however you wish to obtain something that is visibly positioned at different points below - add 2 number variables for each point to be used, i.e, point1X, point1Y, Point2X, Point2Y, Point3X, Point3Y - add a script with random number tile generating 1, 2 or 3 that loops: - determine which of 3 fixed points is to be used this time - turn pen off - move half way to new fixed plot point - turn pen on - move one pixel to draw dot - turn pen off - move back one pixel and repeat above from current point This works but it feels very clunky using E-Toys. Screen shots here if there's interest: http://dang.ath.cx/media/Squeak/plotting01/drawing01.jpg http://dang.ath.cx/media/Squeak/plotting01/drawRandomly01.jpg Things I'd like to improve: - a shorter E-Toys version - a morphic version other than just 'view source' of E-Toys tiles version - be able to subroutine or parameter-ize an E-Toys script with a point or two numbers instead just one parameter and/or repeating code - find a suitable PlotMorph or other class which can be used for the E-Toys version rather than just scribble with penDown=true or create millions of 1 pixel LineMorphs - most of the documentation for morphs with a "point: color" method indicate it is obsolete -- what is one to use plot a point if different than a one pixel line? Any input, thoughts or suggestions for improvement appreciated! Thanks. Best regards, -- DanG Daniel Green, Sun Microsystems dang@xxxxxxx, 877-481-0917
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Preference #menuTitleBorderWidth does nothing?, Petr Fischer |
|---|---|
| Next by Date: | Re: More questions on beginner's lesson, Dave |
| Previous by Thread: | How to squeeze Multiple Inheritance into Squeak ?, Warakorn Paphrawat |
| Next by Thread: | Re: E-Toys and Morphic for simple point plotting exercise?, Bert Freudenberg |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |