is among - problem
Thomas J McGrath III
3mcgrath at adelphia.net
Fri Nov 21 20:49:01 EST 2003
Steve, I see the coding bug got you, too. I used to spend nights
rewriting scripts with a friend of mine (who's name is steve too) and
we would try to get it down to the smallest number of lines. Ahh the
good old days.
Anyway, the problem called for no duplicate numbers in each group of
three So 112, and 333 would be out completely but the code I used to
create the field did that for me, already. The actual group was
1,2,3,4,5,6,7 and then finding every combination of a group of three
that did not overlap in any way SO 123 and 312 could not work and 112
was no good etc.
The answer I came up with was 35 possible combinations. The numbers I
came up with will follow in my next email.
And yes I know the code was wordy but that was because I actually was
putting separate code from three different sources together and never
tried to clean it up.
My real problem was that "is among" was not finding sets of groups that
were similar but transposed. In my need to find a solution I added the
part about converting a line like 123 into 1,2,3 so that "is among"
could work.
I really want to understand why it didn't work though. Any clues???
Thanks
Tom
On Nov 21, 2003, at 8:11 PM, Steve Laming wrote:
> Ooops, 222 still gets deleted, so it would be better to explicitly
> test for duplicates than rely on the addition test therefore:
>
>
>> On MouseUp
>> put false into found
>> put "1,2,3" into search$
>> -- sort field "myList"
>> repeat with x = the number of lines in field "myList" down to 1
>> put char 1 of line x of field "mylist" into test1
>> put char 2 of line x of field "mylist" into test2
>> put char 3 of line x of field "mylist" into test3
>> If test1<>test2 And test1<>test3 AND test2<>test3 then
>> If test1 is among the items of search$ and test2 is among the
>> items of search$ and test3 is among the items of search$ then
>> If found then
>> delete line x of field "myList"
>> beep
>> else
>> put true into found
>>
>>
>> end if
>> end if
>> end if
>> end repeat
>>
>> end MouseUp
>
> I think that is now it!!!! (I hope)
>
> Steve
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
Macintosh PowerBook G-4 OSX 10.3.1, OS 9.2.2, 1.25 GHz, 512MB RAM, Rev
2.1.2
Advanced Media Group
Thomas J McGrath III 2003 3mcgrath at adelphia.net
220 Drake Road, Bethel Park, PA 15102
More information about the use-livecode
mailing list