This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2010-09-05 15:26:07

optyks
New Scratcher
Registered: 2010-09-05
Posts: 12

I feel like an idiot...

I have an assignment due this week in which I need to prompt a user for ten numbers, and then after all numbers are entered, display the largest.
I can't figure it out, and I feel like an idiot because it's not exactly a hard program, i just can't do it.
Any suggestions, hints? I've gone through tons of tutorials, but nothing seems to explain how to do something like this... >.<
Have scratch 1.4

Offline

 

#2 2010-09-05 15:38:27

militarydudes
Scratcher
Registered: 2008-09-12
Posts: 1000+

Re: I feel like an idiot...

Hold on I'm working it out

EDIT: I don't have access to my computer with Scratch on it right now. I'll have get to you later  neutral

Last edited by militarydudes (2010-09-05 15:39:39)


__m. .m__ KILROY WAS HERE
        U

Offline

 

#3 2010-09-05 15:42:13

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: I feel like an idiot...

Considering this is an assignment, I won't give you the exact scripts. But I will give you general instructions on how to do this - you're not an idiot, by the way.  big_smile

Using the "Ask" blocks, as the user for the first number, and put that number into a list. Do the same for the other 9 numbers. Be sure to have the list cleared before the project starts, too.

Then, compare the first item of the list to the second item of the list, and put the larger of the numbers into a variable. Compare that number to the third number, if it's larger, replace the number. Repeat the process for all ten items of the list.

Hopefully that will help you out a bit... If it's not clear enough, I can elaborate which blocks should be used.

Offline

 

#4 2010-09-05 16:46:22

colorfusion
Scratcher
Registered: 2009-10-03
Posts: 500+

Re: I feel like an idiot...

Try making a variable, and set it to 0 at the beginning of the project.
Then, as you ask the person, if the number is higher than the variable, set the variable to the answer.
That is the fastest way.

Offline

 

#5 2010-09-05 17:35:55

optyks
New Scratcher
Registered: 2010-09-05
Posts: 12

Re: I feel like an idiot...

So far this is what I'm looking at... (sorry I can't put it in as an image. Apparently i'm too new)
http://i10.photobucket.com/albums/a115/Falkon114/Picture1-16.png
It's a good step, need to tinker with some things I suppose, but... its not working just right

Offline

 

#6 2010-09-05 18:07:21

optyks
New Scratcher
Registered: 2010-09-05
Posts: 12

Re: I feel like an idiot...

Alright, I figured out that program. Ended up writing it like so:
http://i10.photobucket.com/albums/a115/Falkon114/Picture2-12.png
The next part of my assignment is to ask the user for an upper range limit, take a random number, and have the user try to guess it. Print "higher" if their guess is low, "lower" if their guess is high, and say "you win" if they guess it within x tries, "you lose" if they dont.
This is my progress on that....
http://i10.photobucket.com/albums/a115/Falkon114/Picture3-5.png

Thanks for help, and any other hints or suggestions? Like the previous program, I clearly need to mess around a bit more.

Offline

 

#7 2010-09-05 20:02:36

scmb1
Scratch Team
Registered: 2009-03-19
Posts: 1000+

Re: I feel like an idiot...

Make a variable (I'll call it "tries"). At the beginning, set "tries" to 0. Instead of using "repeat (5)", use a "repeat until." Every time it repeats, change "tries" by one. Make it repeat until "tries" is more than x OR the answer is correct. If the answer is correct, give your "correct" answer. Otherwise, give your "you lose" message. Does that help?


http://i48.tinypic.com/2z5pqad.png

Offline

 

#8 2010-09-06 14:05:44

optyks
New Scratcher
Registered: 2010-09-05
Posts: 12

Re: I feel like an idiot...

I know what you mean, but I'm confused as to  what I should take out and replace

Offline

 

Board footer