Hey all! I am doing a school project on computer programing, and using scratch as a visual aid. I am trying to transfer the program HiLo from HICCUP to scratch ( It can be found here here ) And for it to work right,i have to ignore remainders after devision. I have tried subtracting the MOD from it, but it seems to not work. The program is hereif you want to dissect it and tell me whats wrong. I am rather new to this, so sorry if there is a fairly obvious response!
Offline
bradtank44 wrote:
Hey all! I am doing a school project on computer programing, and using scratch as a visual aid. I am trying to transfer the program HiLo from HICCUP to scratch ( It can be found here here ) And for it to work right,i have to ignore remainders after devision. I have tried subtracting the MOD from it, but it seems to not work. The program is hereif you want to dissect it and tell me whats wrong. I am rather new to this, so sorry if there is a fairly obvious response!
Hmmm...
Remainder as in 1.3333?
If so, try this.
[blocks]
<round( (( <{ No. }> <-> 0.5 )) ))
[/blocks]
Hope that helps.
Last edited by markyparky56 (2010-12-06 06:44:26)
Offline
There are 3 methods.
1. Check if the dividend is an odd number. If yes, minus 0.5 from the result.
[blocks]<set{ quotient }to( (( <{ dividend }> </> 2 ))
<if> <( (( <{ dividend }> <mod> 2 )) <=> 1 )>
<change{ quotient }by( -0.5
<end>[/blocks]
2. Use this script:
[blocks]<round( (( (( <{ dividend }> </> 2 )) <-> (( (( <{ dividend }> <mod> 2 )) </> 2 )) ))[/blocks]
3. Use the script provided by markyparky56. (Just in case you don't know, the <{ No. }>[/blocks] is the quotient.
Note: All of these methods are assuming <{ divisor }>[/blocks] = 2.
Last edited by mathematics (2010-12-06 07:41:05)
Offline
Sorry I haven't replied. Been busy, I never got to mess with your suggestions, but it all worked out anyway.You should be able to see the finished product on my profile. Thanks!
Offline