CrypticKiwi Posted January 29, 2019 Posted January 29, 2019 hi, i want to list combinations but kinda not all possible combinations for example, i have 11 sets and i need 11 digit combinations {024}{597}{597}{024}{13}{024}{13}{597}{68}{597}{024} ex: 05501015650 is a combination (The first digit of each set) 05501015652 05501015654 05501015690 ... total as i calculated should be around 52488 combinations. but i cant wrap my head around how to code it, can any one help?
Nine Posted January 29, 2019 Posted January 29, 2019 (edited) Here to start you up : Global $Line = 0 HotKeySet ("[ESC]","_Exit") FileDelete ("Test.txt") Local $Set[11][3] = [[0,2,4],[5,9,7],[5,9,7],[0,2,4],[1,3,""],[0,2,4],[1,3,""],[5,9,7],[6,8,""],[5,9,7],[0,2,4]] Combi("", -1, Ubound($Set,1)) Func Combi($Str, $Ind, $MaxLen) if StringLen($Str) = $MaxLen Then $Line += 1 FileWriteLine("Test.txt", "Line " & StringFormat("%05i", $Line) & " : Combination = " & $Str) Return EndIf $Ind += 1 For $j = 0 to Ubound ($Set,2) - ($Set[$Ind][2]=""?2:1) Combi($Str & $Set[$Ind][$j], $Ind, $MaxLen) Next EndFunc Func _Exit () Exit EndFunc Recursion is a nice thing, but it is not the fastest. Maybe adding a progress bar. And using file handle will greatly increase the speed... Edited January 29, 2019 by Nine CrypticKiwi 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Nagasa Posted January 29, 2019 Posted January 29, 2019 The above post by @Nine will work, i also recently added this exact thing to the code snippets: I have it as a function down in the reply's. ~ Just Your Friendly Neighborhood Nerd With Too Much Free Time.~
CrypticKiwi Posted January 29, 2019 Author Posted January 29, 2019 Thanks Nine, it works perfectly, also thanks Nagasa Nagasa 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now