Jump to content



Photo

Make a number combinations


  • Please log in to reply
15 replies to this topic

#1 Read

Read

    Adventurer

  • Active Members
  • PipPip
  • 108 posts

Posted 11 May 2012 - 05:44 PM

I have six numbers and how to make combinations?

Example:
Numbers:
01 02 03 04 05 06

Now must make a combinations:
01, 02, 03, 04, 05
01, 02, 03, 04, 06
01, 02, 03, 05, 06
01, 02, 04, 05, 06
01, 03, 04, 05, 06
02, 03, 04, 05, 06

We must use array:
16 23 34 36 37 44
13 17 26 30 32 38

and to make of combinations...

Very thanks







#2 jdelaney

jdelaney

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,069 posts

Posted 11 May 2012 - 06:04 PM

look into _arraypermute and _arraycombinations, or please explain your issue a bit more...

#3 Read

Read

    Adventurer

  • Active Members
  • PipPip
  • 108 posts

Posted 11 May 2012 - 07:11 PM

My English is not good.
Array: 01 02 03 04 05 06

And make of combinations... 01 02 03 04 05 06
result:
01, 02, 03, 04, 05
01, 02, 03, 04, 06
01, 02, 03, 05, 06
01, 02, 04, 05, 06
01, 03, 04, 05, 06
02, 03, 04, 05, 06

Combinations save in .txt file.

#4 jdelaney

jdelaney

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,069 posts

Posted 11 May 2012 - 07:48 PM

there is nothing to understand, run it ;)

#include <Array.au3> Local $aArray[6] = ["01","02","03","04","05","06"] Local $aNewArray = _ArrayPermute($aArray, ",") ;Using Default Parameters _ArrayDisplay($aNewArray, "Array Permuted")

Edited by jdelaney, 11 May 2012 - 08:58 PM.


#5 Read

Read

    Adventurer

  • Active Members
  • PipPip
  • 108 posts

Posted 11 May 2012 - 08:56 PM

Cant understand...

#6 boththose

boththose

    that means two things

  • Active Members
  • PipPipPipPipPipPip
  • 904 posts

Posted 11 May 2012 - 09:02 PM

Cant understand...

Then this might not help either, but dumping this array to a txt file looks similar to your expected result

#include<array.au3> Local $aArray[6] = ["01","02","03","04","05","06"] Local $aNewArray = _ArrayCombinations($aArray, 5 , ",") _ArrayDisplay($aNewArray, "Array Combos")

Edited by boththose, 11 May 2012 - 09:03 PM.

Spoiler

#7 Read

Read

    Adventurer

  • Active Members
  • PipPip
  • 108 posts

Posted 11 May 2012 - 09:15 PM

Now is correct but i add more line and not work anymore.

#include<array.au3> Local $aArray[6] = ["01","02","03","04","05","06"] Local $aArray[6] = ["7","9","18","19","35","40"] Local $aNewArray = _ArrayCombinations($aArray, 5 , ",") _ArrayDisplay($aNewArray, "Array Combos")


#8 boththose

boththose

    that means two things

  • Active Members
  • PipPipPipPipPipPip
  • 904 posts

Posted 11 May 2012 - 09:23 PM

#include<array.au3> Local $aArray[6] = ["01","02","03","04","05","06"] _ArrayDisplay($aArray, "Array Combos") Local $aArray[6] = ["7","9","18","19","35","40"] _ArrayDisplay($aArray, "Array Combos")


You are not doing what you intend. Read the helpfile.
Spoiler

#9 Read

Read

    Adventurer

  • Active Members
  • PipPip
  • 108 posts

Posted 11 May 2012 - 09:47 PM

i'm not programmer...

Somebody...

#10 somdcomputerguy

somdcomputerguy

  • Active Members
  • PipPipPipPipPipPip
  • 2,414 posts

Posted 12 May 2012 - 02:26 AM

Now is correct but i add more line and not work anymore.

#include<array.au3> Local $aArray[6] = ["01","02","03","04","05","06"] Local $aArray[6] = ["7","9","18","19","35","40"] Local $aNewArray = _ArrayCombinations($aArray, 5 , ",") _ArrayDisplay($aNewArray, "Array Combos")

You have two variables with the same name. Rename one of them.
- Bruce /* somdcomputerguy */If you change the way you look at things, the things you look at change.

#11 Read

Read

    Adventurer

  • Active Members
  • PipPip
  • 108 posts

Posted 12 May 2012 - 05:25 AM

How How How???


You have two variables with the same name. Rename one of them.


Edited by Read, 12 May 2012 - 05:26 AM.


#12 boththose

boththose

    that means two things

  • Active Members
  • PipPipPipPipPipPip
  • 904 posts

Posted 12 May 2012 - 02:20 PM

you are really not going to explore the helpfile, or even try? you should change your name to "not going to read".. .
Spoiler

#13 Read

Read

    Adventurer

  • Active Members
  • PipPip
  • 108 posts

Posted 12 May 2012 - 06:54 PM

I'm not programmer and don't understand this language.

#14 kylomas

kylomas

    Want to see God laugh? Tell him you have plans!

  • MVPs
  • 2,070 posts

Posted 12 May 2012 - 07:08 PM

Read,

I'm not programmer and don't understand this language.


This would beg the question, "why are you doing this?".

To get help you need to provide examples of what you expect, what is happenning/not happening, and, whatever code you have written.

kylomas
"Really?, How Do you know the're not random numbers?"Forum Rules

#15 Read

Read

    Adventurer

  • Active Members
  • PipPip
  • 108 posts

Posted 12 May 2012 - 07:21 PM

hmm ;)

#include<array.au3> Local $aArray[6] = [("01","02","03","04","05","06")|("7","9","18","19","35","40")] Local $aNewArray = _ArrayCombinations($aArray, 5 , ",") _ArrayDisplay($aNewArray, "Array Combos")

Edited by Read, 12 May 2012 - 07:22 PM.


#16 somdcomputerguy

somdcomputerguy

  • Active Members
  • PipPipPipPipPipPip
  • 2,414 posts

Posted 12 May 2012 - 08:21 PM

You have two variables with the same name. Rename one of them.

How How How???

#include<array.au3> Local $aArray[6] = ["01","02","03","04","05","06"] Local $aArray[6] = ["7","9","18","19","35","40"] Local $aNewArray = _ArrayCombinations($aArray, 5 , ",") _ArrayDisplay($aNewArray, "Array Combos")

#include<array.au3> Local $aArray[6] = ["01","02","03","04","05","06"] Local $bArray[6] = ["7","9","18","19","35","40"] ; this array is not named the same as the one before it! Local $aNewArray = _ArrayCombinations($aArray, 5 , ",") _ArrayDisplay($aNewArray, "Array Combos")

See the difference? Perhaps I confused you by calling an array a variable..

Edited by somdcomputerguy, 12 May 2012 - 08:22 PM.

- Bruce /* somdcomputerguy */If you change the way you look at things, the things you look at change.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users