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

#1 2012-09-10 20:12:55

bullelk12
Scratcher
Registered: 2012-05-26
Posts: 100+

Tough list problem

I need an AI to be able to tell if there are 4  1s or 2s or anything of the same value adjacent to each other within a list. Simple but very hard unless I'm mistaken. e.g. 011110. So now the AI has to determine if there are four numbers of the same value adjacent to each other. In the example there is, since there are four 1s.
If it's too hard or impossible to be able to tell with anything of the same value, then I still want to know how to do it with just 1s.

I can do the rest I just need to now how to that one part. But it CANNOT be manually done. That would take me an eternity to do.


http://mag.racked.eu/cimage/i6000/Achievement++get%21/Scratcher+love+minecraft%21/mca.png

Offline

 

#2 2012-09-10 20:28:00

danwoodski
Scratcher
Registered: 2009-12-23
Posts: 100+

Re: Tough list problem

I'm working on it...give me a few minutes...


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://dl.dropbox.com/u/12506914/Pics/p2e-2.png&link2=http://dl.dropbox.com/u/12506914/Pics/ms.png&link3=http://dl.dropbox.com/u/12506914/Pics/block%20lib.png
Starting to move on to other languages, but I'll still be around from time to time  smile

Offline

 

#3 2012-09-10 20:32:50

bullelk12
Scratcher
Registered: 2012-05-26
Posts: 100+

Re: Tough list problem

great!


http://mag.racked.eu/cimage/i6000/Achievement++get%21/Scratcher+love+minecraft%21/mca.png

Offline

 

#4 2012-09-10 20:36:22

danwoodski
Scratcher
Registered: 2009-12-23
Posts: 100+

Re: Tough list problem

This should work...

set [counter1 v] to [1]
set [current value v] to [n/a]
set [# of occurances v] to [0]
repeat (length of [list v] )  

if <(item (counter1) of [list v] ) = (current value)>

change [# of occurances v] by (1)
if <(# of occurances) > [2]> 

say (join (current value) [ has occured 4 times.]) for (2) secs
end

else

set [# of occurances v] to [0]
set [current value v] to (item (counter1) of [list v] )
end

change [counter1 v] by (1)
end


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://dl.dropbox.com/u/12506914/Pics/p2e-2.png&amp;link2=http://dl.dropbox.com/u/12506914/Pics/ms.png&amp;link3=http://dl.dropbox.com/u/12506914/Pics/block%20lib.png
Starting to move on to other languages, but I'll still be around from time to time  smile

Offline

 

#5 2012-09-10 20:38:01

bullelk12
Scratcher
Registered: 2012-05-26
Posts: 100+

Re: Tough list problem

That could work, I'll try it.

thx


http://mag.racked.eu/cimage/i6000/Achievement++get%21/Scratcher+love+minecraft%21/mca.png

Offline

 

#6 2012-09-10 20:46:33

bullelk12
Scratcher
Registered: 2012-05-26
Posts: 100+

Re: Tough list problem

It worked. Credit to you man, I worked on that one for an hour. Came a ways but met  with the same problem.

Last edited by bullelk12 (2012-09-10 20:52:04)


http://mag.racked.eu/cimage/i6000/Achievement++get%21/Scratcher+love+minecraft%21/mca.png

Offline

 

Board footer