forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Combinations...
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Tue May 27, 2003 10:36 pm    Post subject: Combinations... Reply with quote

I'm absolutely stumped on how to make every possible combination of
a string of numbers starting at 0 and ending at 255.

I'm trying to make a script which will make every combination of numbers
starting from 0|0|0 to 255|255|255. I have spent many hours thinking
about this and I just don't know how it is done. Confused

In other words, I need help on making a script that makes every
combination, such as 245|32|80 etc., all the way to 255|255|255.

Thanks in advance for any help! Very Happy

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Tue May 27, 2003 11:24 pm    Post subject: Reply with quote

Parse the string since it has "|" in it. Use IF @GREATER() to insure that
each is not greater than 255, if so, then take the number back down to
255.

Then for low end, IF @EQUAL(@SUBSTR(%%VAR,1,1),-), if so, then take
the number back up to 0.

Once done, put all 3 variables back into a string again.

-Garrett
Back to top
View user's profile Send private message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Tue May 27, 2003 11:29 pm    Post subject: Reply with quote

I'm not sure I follow you entirely. Sad

Could you please explain further?

I really appreciate your help. Very Happy

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Wed May 28, 2003 12:46 am    Post subject: Reply with quote

Code:
%%FullVar = -0|256|23
INFO %%FullVar
Option Fieldsep,|
Parse "%%Var1;%%Var2;%%Var3",%%FullVar
If @greater(%%Var1,255)
  %%Var1 = 255
ElsIf @equal(@substr(%%Var1,1,1),-)
  %%Var1 = 0
End
If @greater(%%Var2,255)
  %%Var2 = 255
ElsIf @equal(@substr(%%Var2,1,1),-)
  %%Var2 = 0
End
If @greater(%%Var3,255)
  %%Var3 = 255
ElsIf @equal(@substr(%%Var3,1,1),-)
  %%Var3 = 0
End
%%FullVar = %%Var1|%%Var2|%%Var3
INFO %%FullVar


-Garrett
Back to top
View user's profile Send private message
Aslan
Valued Contributor
Valued Contributor


Joined: 31 May 2001
Posts: 589
Location: Memphis, TN USA

PostPosted: Wed May 28, 2003 12:47 am    Post subject: Reply with quote

The basic premis would be as follows

Code:

List create,1
%A = 0
%B = 0
%C = 0
%D = 0
list add,1,%A|%B|%C
repeat
   If @equal(%D,1)
    %A = @succ(%A)
   end
   list add,1,%A|%B|%C
    repeat
    If @equal(%D,1)
     %B = @succ(%B)
    end
    list add,1,%A|%B|%C
        repeat
        If @equal(%D,1)
          %C = @succ(%C)
        end
         %D = 1
          list add,1,%A|%B|%C
        until @equal(%C,255)
       %C = 0
   until @equal(%B,255)
   %B = 0
until @equal(%A,255)
list savefile,c:\count.txt
shell open,c:\count.txt 
end


%D is to make sure that "0" is used before @succ()

The problem here is that your list will run out of memory when %A gets to "3" or "4"

Maybe if you somehow played with it to get more than one set per line.

I think I read in a earlier post that a list has a maximum number of characters

Hope this helps get you started.
Back to top
View user's profile Send private message Send e-mail
Aslan
Valued Contributor
Valued Contributor


Joined: 31 May 2001
Posts: 589
Location: Memphis, TN USA

PostPosted: Wed May 28, 2003 1:20 am    Post subject: Reply with quote

Here is a visual example Laughing

Code:

  DIALOG CREATE,Test,-1,0,40,27
  DIALOG ADD,text,TX,6,24,,,
  DIALOG SHOW
%A = 0
%B = 0
%C = 0
%D = 0
dialog set,tx,%A|%B|%C
repeat
   If @equal(%D,1)
    %A = @succ(%A)
   end
   dialog set,tx,%A|%B|%C
    repeat
    If @equal(%D,1)
     %B = @succ(%B)
    end
    dialog set,tx,%A|%B|%C
        repeat
        If @equal(%D,1)
          %C = @succ(%C)
        end
         %D = 1
           dialog set,tx,%A|%B|%C
rem ** remove the "REM" below to see it slower **
rem         wait .001
        %E = @event()
        If %E
        goto %E
        end
        until @equal(%C,255)
       %C = 0
   until @equal(%B,255)
   %B = 0
until @equal(%A,255)
:close
end
Back to top
View user's profile Send private message Send e-mail
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Wed May 28, 2003 2:12 am    Post subject: Reply with quote

Looks like I misunderstood what he wanted.. I think you have what
he's looking for.

-Garrett
Back to top
View user's profile Send private message
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Wed May 28, 2003 6:07 am    Post subject: Reply with quote

Hey FF

Why on Earth do you wanna make such a list?? You need a list of every darn IP address, or what Shocked
Or are ya just trying to pass time in this snoozefest by figuring out how to do it?

Before you do that for real, try to do some simple math of combinations - we're talkin' several billion combinations -
I doubt it that you really wanna try to manage such a GB list in VDS No

Greetz
Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
Hortalonus
Valued Contributor
Valued Contributor


Joined: 15 Mar 2002
Posts: 344
Location: Western USA

PostPosted: Wed May 28, 2003 1:21 pm    Post subject: Reply with quote

Dr. Dread wrote:
just trying to pass time in this snoozefest...

Laughing That is the funniest thing I've heard in a long time! Here we are just trying to pass time in this snoozefest... waiting for VDS 5. Laughing

_________________
"ah, come take my hand... we're ridin' out tonight to face the promised land"
Get a free iPod mp3 player...
Back to top
View user's profile Send private message Send e-mail
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Wed May 28, 2003 7:05 pm    Post subject: Reply with quote

Dr. Dread wrote:
Hey FF

Why on Earth do you wanna make such a list?? You need a list of every darn IP address, or what Shocked
Or are ya just trying to pass time in this snoozefest by figuring out how to do it?


Well I just wanted to make a cool screensaver. Wink
I wanted it to blend from color to color but I don't know how to do that.
Anyway I wouldn't store a whole list like that, I would just go to the next
color shade/value.

BTW, it's the VDS way of stating an RGB color value. Wink

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Wed May 28, 2003 7:11 pm    Post subject: Reply with quote

BTW, Thanks a million everybody who helped. Very Happy
_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Wed May 28, 2003 7:21 pm    Post subject: Reply with quote

FreezingFire wrote:

Well I just wanted to make a cool screensaver. Wink
I wanted it to blend from color to color but I don't know how to do that.
Anyway I wouldn't store a whole list like that, I would just go to the next
color shade/value.

BTW, it's the VDS way of stating an RGB color value. Wink


Ahaaaa. So it was RGB values Embarassed he-he, in my mind it was IP addresses - that what ya get for posting
sooo early in the morning Very Happy
Can't believe I missed the RGB connection - I'm currently trying to figure out how to calculate complementary colors
and split complementary colors for a given color.

Anyways good luck with you colorful screensaver Wink

Greetz
Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Fri May 30, 2003 1:35 pm    Post subject: Reply with quote

Dr. Dread wrote:
Hey FF

Why on Earth do you wanna make such a list?? You need a list of every darn IP addressGreetz
Dread


BTW Dr. Dread IP addresses have 4 octets in them not 3 like RGB Very Happy

192.168.000.001 = IP address

128|128|128 = RGB colors

Anyway WAKE UP! Laughing

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Fri May 30, 2003 1:46 pm    Post subject: Reply with quote

mindpower wrote:

BTW Dr. Dread IP addresses have 4 octets in them not 3 like RGB Very Happy

192.168.000.001 = IP address

128|128|128 = RGB colors


Yeah, I know. That's why I said the possible combinations would go into billions - with just three it'll only
be about 16 million.

And that's why that post was sooooo off on a tangent Very Happy

mindpower wrote:
Anyway WAKE UP! Laughing


Yup, just slapped myself - now I'm wide awake and ready for action...

Not much action around, though - still a snoozefest around here.

Greetz
Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Wed Jul 16, 2003 11:12 pm    Post subject: Reply with quote

How can I extend the example above to work with four numbers like:

#|#|#|#

I appreciate any help. Very Happy

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group