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

#1 2010-09-11 14:53:33

darkness3560
Scratcher
Registered: 2010-07-28
Posts: 30

How do i program a redundancy checker?

I am making a program called Perfectlunch, where you input foods, and the amount of items in lunch, and it makes a lunch. But the problem is that sometimes it lists things twice. So can someone tell me how to make a redundancy checker for lists?


http://1024128.webs.com/1.pnghttp://1024128.webs.com/2.pnghttp://1024128.webs.com/3.pnghttp://1024128.webs.com/4.png
Pi is Pi, and Pi is 3.1415926535897932384626433832795028841971693993751058209749.

Offline

 

#2 2010-09-11 15:01:33

ihaveamac
Scratcher
Registered: 2007-09-22
Posts: 1000+

Re: How do i program a redundancy checker?

http://i25.servimg.com/u/f25/12/25/55/91/script10.gif


~ihaveamac - visit ihaveamac.net

Offline

 

#3 2010-09-12 10:10:07

darkness3560
Scratcher
Registered: 2010-07-28
Posts: 30

Re: How do i program a redundancy checker?

Thanks, but I need to check if there are two of the same item of the thing in a list.


http://1024128.webs.com/1.pnghttp://1024128.webs.com/2.pnghttp://1024128.webs.com/3.pnghttp://1024128.webs.com/4.png
Pi is Pi, and Pi is 3.1415926535897932384626433832795028841971693993751058209749.

Offline

 

#4 2010-09-12 11:03:55

JeanTheFox
Scratcher
Registered: 2010-06-14
Posts: 1000+

Re: How do i program a redundancy checker?

http://i55.tinypic.com/2zsybo9.png
Like this?


http://i51.tinypic.com/20gcn5j.png

Offline

 

#5 2010-09-12 11:10:02

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: How do i program a redundancy checker?

JeanTheFox wrote:

http://i55.tinypic.com/2zsybo9.png
Like this?

I don't think that would work, unfortunately. If you want to check for duplicates, I think you have to find the first instance of the item, delete it, then check for other instances, delete those also, and finally put the first instance back where it was.


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#6 2010-09-12 20:31:46

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: How do i program a redundancy checker?

If you're having a list that contains the items in the lunch, make it check if a food's already in the list before adding it. Something like this:

http://img27.imageshack.us/img27/940/309checkingifafoodisina.png

It only adds a food to the lunch if it isn't already in there.  smile

Interesting project, by the way.  big_smile


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#7 2010-09-12 20:39:58

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: How do i program a redundancy checker?

Try this:
http://i821.photobucket.com/albums/zz140/Sunrisemoon/Foodhelp.gif


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#8 2010-09-16 05:31:00

SamSamson
New Scratcher
Registered: 2010-09-01
Posts: 42

Re: How do i program a redundancy checker?

Cool!!!!!!!

Offline

 

Board footer