MultiColor Calculations

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • OptikConnex

    MultiColor Calculations

    I need to make a program that uses ten basic colors (eg. red,green,blue) in combinations. I need each color to make a combination as a pair and triple with other colors. For example: red|green, red|blue, red|yellow, green|blue, and so on, but you can't use green|red because we already use red|green. Get it?, then i have to make multiples of threes as well red|green|blue etc..
    I have no idea where to begin or how I should set this up, I sure in an array of some sort or recursive callbacks, any suggestions would be appreciated
    Thanks.
  • Dominique Vandensteen

    #2
    Re: MultiColor Calculations

    something like

    dim colors() as String
    dim duoColorCollect ion as Collection

    dim i as integer
    dim j as integer

    for i = 0 to colors.lenght - 2
    for j=i +1 to colors.lenght - 1
    duoColorCollect ion.add(colors( i) + "-" + colors(j))
    next j
    next i

    duocollorscolle ction will contain all "mixed" colors but no "inverse equals"

    i hope what i wrote is right, did it without testing ;-)
    but the system can be something like this


    hope this helps

    dominique


    "OptikConne x" <anonymous@disc ussions.microso ft.com> wrote in message
    news:BE3820D8-6375-4873-9BF2-4C682DA60F2C@mi crosoft.com...[color=blue]
    > I need to make a program that uses ten basic colors (eg. red,green,blue)[/color]
    in combinations. I need each color to make a combination as a pair and
    triple with other colors. For example: red|green, red|blue, red|yellow,
    green|blue, and so on, but you can't use green|red because we already use
    red|green. Get it?, then i have to make multiples of threes as well
    red|green|blue etc...[color=blue]
    > I have no idea where to begin or how I should set this up, I sure in an[/color]
    array of some sort or recursive callbacks, any suggestions would be
    appreciated.[color=blue]
    > Thanks.[/color]


    Comment

    • OptikConnex

      #3
      Re: Dominique

      I don't quite see what you are doing in your posted code. How would I display the colors side by side then. And what are you assigning colors to
      dim colors() as Strin
      dim duoColorCollect ion as Collectio

      dim i as intege
      dim j as intege

      for i = 0 to colors.lenght -
      for j=i +1 to colors.lenght -
      duoColorCollect ion.add(colors( i) + "-" + colors(j)
      next
      next

      Comment

      • OptikConnex

        #4
        Re: Dominique

        Scratch that last comment i see what you are doing. Just needed the caffeine to get me going. But now I get an erro
        at this line of code: duoColorCollect ion.Add(colors( i) + "-" + colors(j)) what do i need to do next

        Dim colors(4) As Strin
        Dim duoColorCollect ion As Collectio

        Dim i As Intege
        Dim j As Intege
        colors(1) = "Red
        colors(2) = "Green
        colors(3) = "Blue
        colors(4) = "Purple

        For i = 0 To colors.Length -
        For j = i + 1 To colors.Length -
        duoColorCollect ion.Add(colors( i) + "-" + colors(j)
        Next
        Next

        Comment

        • OptikConnex

          #5
          Re: MultiColor Calculations

          OK I figured most of it out now, but how do I display the results. Here is the code

          Dim colors(4) As Strin
          Dim duoColorCollect ion As New Collectio

          Dim i As Intege
          Dim j As Intege
          colors(1) = "Red
          colors(2) = "Green
          colors(3) = "Blue
          colors(4) = "Purple

          For i = 0 To colors.Length -
          For j = i + 1 To colors.Length -
          duoColorCollect ion.Add(colors( i) + "-" + colors(j)
          Next
          Next
          Where do I display my results eg red-gree
          Im an idiot, I know but things aren't clicking today.

          Comment

          • Dominique Vandensteen

            #6
            Re: MultiColor Calculations

            your duocolorcollect ion is a collection containing strings ("Red-Green",
            "Red-Blue", ...)

            so just do something like

            dim oneColor as string
            for each oneColor in duoColorCollect ion
            debug.writeline (oneColor)
            next


            PS:
            I even didn't know the collection object realy exists, i was pointing to
            some kind of collection object (arraylist,...)
            java background you know ;-)


            "OptikConne x" <anonymous@disc ussions.microso ft.com> wrote in message
            news:277058C7-105C-4F85-BC1F-920F054161EC@mi crosoft.com...[color=blue]
            > OK I figured most of it out now, but how do I display the results. Here is[/color]
            the code.[color=blue]
            >
            > Dim colors(4) As String
            > Dim duoColorCollect ion As New Collection
            >
            > Dim i As Integer
            > Dim j As Integer
            > colors(1) = "Red"
            > colors(2) = "Green"
            > colors(3) = "Blue"
            > colors(4) = "Purple"
            >
            > For i = 0 To colors.Length - 2
            > For j = i + 1 To colors.Length - 1
            > duoColorCollect ion.Add(colors( i) + "-" + colors(j))
            > Next j
            > Next i
            > Where do I display my results eg red-green
            > Im an idiot, I know but things aren't clicking today.[/color]


            Comment

            Working...