I've notived that when I exit, it doesn't give the usual 'Would you like to save before you quit?' pop-up. And when I'm in a rush, sometimes I lose a good hours work because I forgot to save.
I've added this feature to many of my own projects in other coding languages and it isn't too hard.
HOpefully you will include it in next version of scratch.
Thanks in Advance.
Offline
We're always trying to find the right balance between (1) adding new functionality, (2) keeping Scratch simple and understandable. We didn't add too many advanced math features since we worried that they might be intimidating and confusing for some Scratch users. We have considered ways for "advanced users" to get access to additional blocks, but we haven't come up with a good way to do that yet.
Mitch Resnick
MIT Scratch Team
Offline
Hi tstirler
For now there are some tricks that I use to generate sine waves. I first thought about lookup tables, but then I remembered that cosine comes from a circle, so I made this project
http://scratch.mit.edu/projects/jay/243
where I just set the y-value of the cosine wave to the y-value of the ball that's moving in a circle. Then I move the cosine wave constantly in the x direction.
I also noticed this project
http://scratch.mit.edu/projects/Canthiar/6123
which generates a sine wave by using the mathematical functions that Scratch does have.
Offline
I hadn't even thought of calculating sin and cos with an object, but it's so simple. Move to 0 0, set the direction to the angle and move 1 step. Then y is sin, x is cos, and y/x is tan.
If you're deciding on which functions to add then I would think that sin, cos, and sqrt would be the most used.
A lot of people have been asking for user defined functions. If you add a user function block then you can distribute a sprite that has a lot of these functions pre-written that people can just import into their programs. It would be nice if it didn't slow the program down the way [broadcast[ ] and wait] does.
Offline
I thought about Canthiar's suggestion about using a sprite to calculate trig functions and came up with the following little project:
http://scratch.mit.edu/projects/Roberth/8335
Canthiar got the x and y components mixed up, but otherwise was spot on. I also used a circle 150 units in size to help add to the resolution of the numbers. This is also a fantastic way of demonstrating trig functions and explaining this to a group of kids that these numbers aren't just pulled out of the air, but have real meaning in a physical sense.
I added as the value of "infinity" for a tangent of 90 to be 1000000, but this is just an arbitrary value. The code got an error when you divided by 0 (as it should!) and threw in a special test case for that possibility. This would also be an interesting example to explain limit theory from an introductory viewpoint, and explaining what happens as you get closer and closer to 90 degrees for a tangent but don't quite get there... and perhaps to give a mathematical explanation that can also be demonstrated with a Scratch program.
Offline
Cool. Sorry about mixing up the axes, I guess I keep thinking of 0 degrees as going to the right and 90 degrees going up. If [broadcast[] and wait] was faster I would prefer to use this method since Scratch seems to have some problems retaining constant values with my calculated version.
Offline
Canthiar didn't mix up the x and y axes, the Scratch team did. And I understand that they did it deliberately, though why they wanted to use non-standard angle naming, and make the default angle 90 degrees is still a mystery to me.
Offline
What I thing would be cool is if you could set up a high score board for games. It could display the top 5 highest values for a varrible that the project owner could pick.
Offline
Canthiar wrote:
If you're deciding on which functions to add then I would think that sin, cos, and sqrt would be the most used.
Here is a square root to round out the set:
http://scratch.mit.edu/projects/DrJim/8537
(The reference URL was long enough that the notes are below the screen.)
Offline
Canthiar wrote:
DrJim, how many iterations does it take for your square root to converge?
It's quadratically convergent so it usually "improves" by about two significant figures every itteration. Not something you can count on, however. If your initial guess is wildly off or you're at troublesome points (say 0.999999) you can take longer. Also this particular algorith does not (I'm pretty sure) let you know when you have an exact square root, i.e., it won't specifically tell you 5 is the exact square root of 25.
For more details, take a quick look at the Wiki references or do a general search on the subject. There is apparently a very fast square root algorithm used in the "Quake 3" engine - but I've never tried it.
Offline
The quake square root is actually an inverse square root with a good initial guess.
The square root that I wrote makes no initial guess and doesn't do much to check for accuracy since I'm just getting to run for speed. Scratch seems to have some issues with loops causing programs to slow down.
Offline
Dr. Jim's algorithm, like Canthiar's, is the standard Newton iteration. One has to be a bit careful when handling zero, but it is a fine algorithm.
The fast algorithms usually make a quick initial guess (using the structure of floating point numbers) then do a few iterations of Newton's method. Since we have no access to the bits of the floating-point representation in scratch, Newton's method is likely to be the best we can do.
Offline
It would be cool if you could set a script and refer to it later.
[blocks] <set{ Script }to( : [/blocks]
[blocks]<move( 10 )steps>[/blocks]
[blocks]<turn cw( 10 )degrees>[/blocks]
[blocks]<next costume>[/blocks]
This way you could just do...
[blocks]<forever>[/blocks]
[blocks]<{ Script }>[/blocks]
[blocks]<end>[/blocks]
...instead of...
[blocks]<forever>[/blocks]
[blocks]<move( 10 )steps>[/blocks]
[blocks]<turn cw( 10 )degrees>[/blocks]
[blocks]<next costume>[/blocks]
[blocks]<end>[/blocks]
...every time you wanted to use that set of blocks.
Last edited by Carcabob1 (2010-03-19 19:31:24)
Offline
This seems to be quite an old [and misplaced!] thread. Being that the thread is old, I'll have the thread closed.
Discussions about new requests for the next version of Scratch can be made in the 'Suggestions' forum.

Offline