archmage wrote:
Hey here's a small challenge that will test your problem solving skills.
Create a program that will generate a random number between 10 and 100 and if the number generated is a multiple of 5 make a sprite say "Beep" if the number is a multiple of 3 make the sprite say "Boop" and if the number is a multiple of both 3 and 5 make the sprite say "Bop".
I got this as a question for my pascal programming test. You can use any thing at your disposal just make the program work.
@ JoelP : scratch currently lacks the Math methods to create 3-D shapes like polygons. Perhaps when the scratch program is updated someone can set up a 3D challenge.
Cathier created a 3-D program by emulating math functions needed to create matrices.
That was fun!
Here's mine. http://scratch.mit.edu/projects/Mick/62768
Offline
Ok here is another challenge since so many people enjoyed the first one.
Create a variable called distance and 2 sprites.
What I want the project to do is randomize the position of the sprites each time the flag is clicked and have the variable "distance" display the distance between the 2 sprites.
Now the hard part. The project must NOT use the <distance to[ block.
Now for those who have no clue how to do this.
You will have to use Pythagoras's theorem which states that A squared plus B squared is equal to C squared.
Learn more @ http://www.mathsisfun.com/pythagoras.html
This is a good way to become acquainted with the new math methods featured in scratch v1.2
Last edited by archmage (2007-12-05 16:45:19)
Offline
i have a quiz that we could put in... it's in my gallary, the impossible quiz.
Offline
In the equation a2+b2=c2 , the c variable will be the distance between sprite1 and sprite2 given that variable a is sprite1 xposition - sprite2 xposition and variable b is sprite1 yposition- sprite2 yposition.
So to get c you will have to find the square root of c squared.
Last edited by archmage (2007-12-23 18:37:44)
Offline
Am I worng or right with this, if i am wrong then what is wrong, my brain hurts!:
Sprite 1:
[blocks]
<when green flag clicked>
<go to x
<pick random( -20 )to( -200 )y
0
<set{ a }to( (( x position of sprite 1 <-> x position of sprite 2 ))
<set{ b }to( (( x position of sprite 1 <-> x position of sprite 2 ))
<set{ c }to( sqrt of (( (( a <*> a )) <+> (( b <*> b )) ))
[/blocks]
Sprite 2:
[blocks]
<when green flag clicked>
<go to x
<pick random( 20 )to( 200 )y
0
Last edited by messd002 (2007-12-23 15:23:40)
Offline
messd002 wrote:
Am I worng or right with this, if i am wrong then what is wrong, my brain hurts!:
Sprite 1:
[blocks]
<when green flag clicked>
<go to x<pick random( -20 )to( -200 )y
0
<set{ a }to( (( x position of sprite 1 <-> x position of sprite 2 ))
<set{ b }to( (( x position of sprite 1 <-> x position of sprite 2 ))
<set{ c }to( sqrt of (( (( a <*> a )) <+> (( b <*> b )) ))
[/blocks]
Sprite 2:
[blocks]
<when green flag clicked>
<go to x<pick random( 20 )to( 200 )y
0
Sorry I wasn't thinking when I typed out the explanation
b is supposed to involve y position
//like this
<set{ a }to( (( x position of sprite 1 <-> x position of sprite 2 ))
<set{ b }to( (( y position of sprite 1 <-> y position of sprite 2 ))
<set{ c }to( sqrt of (( (( a <*> a )) <+> (( b <*> b )) ))
This would be correct
Offline
archmage wrote:
Hey here's a small challenge that will test your problem solving skills.
Create a program that will generate a random number between 10 and 100 and if the number generated is a multiple of 5 make a sprite say "Beep" if the number is a multiple of 3 make the sprite say "Boop" and if the number is a multiple of both 3 and 5 make the sprite say "Bop".
I got this as a question for my pascal programming test. You can use any thing at your disposal just make the program work.
That is easy, just make some recordings and use the (__ mode __) block.
Offline
There's a remainder block? Did not know that. I was using round. So you divide the number by 3, round it, multiply it by three, and if it equals the original, it's divisible by 3.
Offline
Oh! It was?
Last edited by Zxblqcktptyjsplkn (2010-03-09 10:23:21)
Offline
Zxblqcktptyjsplkn wrote:
There's a remainder block? Did not know that. I was using round. So you divide the number by 3, round it, multiply it by three, and if it equals the original, it's divisible by 3.
You can use the Mod function (under Operators) which gives the remainder of a division. To find out if a number N is divisible by 3 you would say If N Mod 3 = 0
Offline
I know what mod does. I just didn't know Scratch had it. I'll try to avoid grave-digging in the future.
Offline
Chimpanzee wrote:
Advert: PLEASE GO ON MY RIDDLE GAME !
please don't spam
Offline