Sign in to follow this  
Followers 0
butterfly

Building My Multy array smarter then for/next

5 posts in this topic

Hello all, the code works as intended although it took me 25 min to figure this method out ha ha (yeah,yeah i am the slowest and crappiest coder)

here is my code and I wonder if there are better methods then this so i can learn from it.....

#include <Array.au3>

    $ansRarity = "B,Any Rarity;N,Mythic;F,Mythic;A,Rare;A,Uncommon;F,Common;N,Common"
    $ansFormats = "All cards Online;Standard;Extended;Classic;Legacy;Modern;Pauper;Theros Block;Return to Ravnica Block;Core Sets;Masters Edition;Special Sets;Promotional;Modern Masters"
    $arrayRarity = StringSplit($ansRarity, ";")
    $arrayFormats = StringSplit($ansFormats, ";")
    _ArrayDisplay($arrayRarity)
    _ArrayDisplay($arrayFormats)
    $n =  $arrayFormats[0] * $arrayRarity[0]
    Dim $RarityFormatSearch[$n + 1][2]
    $RarityFormatSearch[0][0] = $n
    $x = 0
    For $z = 1 To $arrayFormats[0]
        for $y = 1 To $arrayRarity[0]
            $x = $x + 1
        $RarityFormatSearch[$x][1] = $arrayRarity[$y]
        Next
    Next
$x = 0
    For $z = 1 To $arrayFormats[0]
        for $y = 1 To $arrayRarity[0]
            $x = $x + 1
            $RarityFormatSearch[$x][0] = $arrayFormats[$z]
        Next
    Next
_ArrayDisplay($RarityFormatSearch)

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Well it works as intended (resultwise)

my end result is perfect as shown _ArrayDisplay($RarityFormatSearch)

it is a function that creates a array of how I am going to search for something

as example

I have 3 rooms:

bathroom livingroom and kitchen

and each room has stuff in it like

Lamp, seat and sink

because I want to search things in order i am searching in 1 room at a time for 3 things

bathroom > Lamp

bathroom > seat

bathroom > sink

livingroom >Lamp

livingroom >seat

livingroom >sink

kitchen>Lamp

kitchen>seat

kitchen>sink

and voila my array is in order and this will be the quickest way of searching

I was just wondering if there is an lightly smarter or much smarter ways of doing this then my code

Edited by butterfly

Share this post


Link to post
Share on other sites

The second loop is redundant:

#include <Array.au3>

    $ansRarity = "B,Any Rarity;N,Mythic;F,Mythic;A,Rare;A,Uncommon;F,Common;N,Common"
    $ansFormats = "All cards Online;Standard;Extended;Classic;Legacy;Modern;Pauper;Theros Block;Return to Ravnica Block;Core Sets;Masters Edition;Special Sets;Promotional;Modern Masters"
    $arrayRarity = StringSplit($ansRarity, ";")
    $arrayFormats = StringSplit($ansFormats, ";")
    _ArrayDisplay($arrayRarity)
    _ArrayDisplay($arrayFormats)
    $n =  $arrayFormats[0] * $arrayRarity[0]
    Dim $RarityFormatSearch[$n + 1][2]
    $RarityFormatSearch[0][0] = $n
    $x = 0
    For $z = 1 To $arrayFormats[0]
        for $y = 1 To $arrayRarity[0]
            $x = $x + 1
        $RarityFormatSearch[$x][0] = $arrayFormats[$z]
        $RarityFormatSearch[$x][1] = $arrayRarity[$y]
        Next
    Next

_ArrayDisplay($RarityFormatSearch)

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

Thank you jdelaney your contribution.

Could not Figure it myself proper :sweating:

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0