GoTRooT 4 Posted July 4, 2019 Report Share Posted July 4, 2019 (edited) I need this pretty often, I could not find it anywhere on here so, for the next person that wishes to: 1. import 3 lists2. export all possible combinations of the 3 lists I made a simple little UI, you will need to write in your variables or import from text files then just hit run. Enjoy. comment ("gpv - ui")ui block text("var 1",#var_01)ui open file("",#var_01)ui block text("var 2",#var_02)ui open file("",#var_02)ui block text("var 3",#var_03)ui open file("",#var_03)ui block text("output",#output)ui button("run") { input_to_list() loop_process()}comment ("gpv - create lists from variables")define input_to_list { clear_vars_lists() add list to list(%var_01,$list from text(#var_01,$new line),"Delete","Global") add list to list(%var_02,$list from text(#var_02,$new line),"Delete","Global") add list to list(%var_03,$list from text(#var_03,$new line),"Delete","Global") set_pos_0()}comment ("gpv - set all var positions to 0")define set_pos_0 { set(#var_01_pos,0,"Global") set(#var_02_pos,0,"Global") set(#var_03_pos,0,"Global")}comment ("gpv - this is the loop, the main and most important element, it will process all 3 variable lists to output all possible combinations")define loop_process { clear list(%output) set(#var_01_pos,0,"Global") loop($list total(%var_01)) { set(#var_02_pos,0,"Global") loop($list total(%var_02)) { set(#var_03_pos,0,"Global") loop($list total(%var_03)) { set(#temp,$nothing,"Global") set(#temp,"{$list item(%var_01,#var_01_pos)} {$list item(%var_02,#var_02_pos)} {$list item(%var_03,#var_03_pos)}","Global") add item to list(%output,#temp,"Delete","Global") set(#temp,$nothing,"Global") increment(#var_03_pos) } increment(#var_02_pos) } increment(#var_01_pos) } clear_vars_lists() set_pos_0() set_vars_nothing() set(#output,$text from list(%output,$new line),"Global")}comment ("gpv - clear input vars")define set_vars_nothing { set(#var_01,$nothing,"Global") set(#var_02,$nothing,"Global") set(#var_03,$nothing,"Global")}comment ("gpv - clear input lists")define clear_vars_lists { clear list(%var_01) clear list(%var_02) clear list(%var_03)}generate_all_possible_combinations.ubot Edited July 4, 2019 by GoTRooT 2 Quote Link to post Share on other sites
HelloInsomnia 1103 Posted July 4, 2019 Report Share Posted July 4, 2019 Looks good and it made me think what if you could accept any number of lists and do this. Use a list to store each list in a list item and make a crazy amount of variations. Although I'm not sure what I'd use it for 2 Quote Link to post Share on other sites
MasteRofBotS 10 Posted July 19, 2019 Report Share Posted July 19, 2019 Looks good and it made me think what if you could accept any number of lists and do this. Use a list to store each list in a list item and make a crazy amount of variations. Although I'm not sure what I'd use it for I read your answer, took a look at the code and the first thing that comes to my mind was to add a kind of level 1 loop that would be run as many times as the user want (ui input) and this way you could combines like 10, 20 or how many lists you freakin want to, to infinity... Plus multiple threads all the way so the number of combinations would grow expotentionally Thanks to both of you guys for making my brain do some abstract thinking 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.