dumbledor Posted December 30, 2008 Share Posted December 30, 2008 Hello! I have written this script: expandcollapse popup#include<array.au3> $si=1 $sj=1 $sk=1 $sz=1 $sy=1 local $array[1] Do Do Do Do Do if $sk <> $si Then if $sk <> $sj Then if $si <> $sj Then If $sz <> $sj Then If $sz <> $si Then If $sz <> $sk Then If $sy <> $si Then If $sy <> $sj Then If $sy <> $sk Then If $sy <> $sz Then ConsoleWrite( $sy&","&$sz&","&$si&","&$sj&","&$sk&@crlf) _ArrayAdd($array, $sy&","&$sz&","&$si&","&$sj&","&$sk) EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf $sk = $sk+1 Until $sk == 7 $sk = 1 $sj = $sj+1 until $sj == 7 $sj = 1 $si = $si +1 Until $si == 7 $si = 1 $sz = $sz +1 Until $sz == 7 $sz = 1 $sy = $sy + 1 Until $sy ==7 _ArrayDisplay($array) Script is doing what it should do (making combinations of 5 elements between 6) but i want to make it better looking. Anybody has any idea, how to make it shorter? More visible? Thanks in advance. Link to comment Share on other sites More sharing options...
FireFox Posted December 30, 2008 Share Posted December 30, 2008 (edited) @dumbledoor Here we go : #include<array.au3> Local $si=1, $sj=1, $sk=1, $sz=1, $sy=1, $array[1] Do Do Do Do Do if $sk <> $si and $sk <> $sj And $si <> $sj And $sz <> $sj And $sz <> $si And $sz <> $sk And $sy <> $si And $sy <> $sj And $sy <> $sk And $sy <> $sz Then ConsoleWrite( $sy&","&$sz&","&$si&","&$sj&","&$sk&@crlf) _ArrayAdd($array, $sy&","&$sz&","&$si&","&$sj&","&$sk) EndIf $sk = $sk+1 Until $sk == 7 $sk = 1 $sj = $sj+1 until $sj == 7 $sj = 1 $si = $si +1 Until $si == 7 $si = 1 $sz = $sz +1 Until $sz == 7 $sz = 1 $sy = $sy + 1 Until $sy ==7 _ArrayDisplay($array) Of course this can be better but i can test it now Cheers, FireFox. Script is doing what it should do (making combinations of 5 elements between 6) but i want to make it better looking. Anybody has any idea, how to make it shorter? More visible? Thanks in advance. Edited December 30, 2008 by FireFox Link to comment Share on other sites More sharing options...
FireFox Posted December 30, 2008 Share Posted December 30, 2008 @dumbledoor Another way : #include<array.au3> Local $si=1, $sj=1, $sk=1, $sz=1, $sy=1, $array[1] For $nb = 1 to 7 For $nb = 1 to 7 For $nb = 1 to 7 For $nb = 1 to 7 For $nb = 1 to 7 if $sk <> $si and $sk <> $sj And $si <> $sj And $sz <> $sj And $sz <> $si And $sz <> $sk And $sy <> $si And $sy <> $sj And $sy <> $sk And $sy <> $sz Then ConsoleWrite( $sy&","&$sz&","&$si&","&$sj&","&$sk&@crlf) _ArrayAdd($array, $sy&","&$sz&","&$si&","&$sj&","&$sk) EndIf Next Next Next Next Next _ArrayDisplay($array) Not sure this is what you want ... Cheers, FireFox. Link to comment Share on other sites More sharing options...
Andreik Posted December 30, 2008 Share Posted December 30, 2008 I don't know if this is a script or you need help. Anyway, read in help file about _ArrayPermute(). When the words fail... music speaks. Link to comment Share on other sites More sharing options...
enaiman Posted December 31, 2008 Share Posted December 31, 2008 ... or better _ArrayCombinations No need to reinvent the wheel SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
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