Sign in to follow this  
Followers 0
Martzen

2d array element count

4 posts in this topic

#1 ·  Posted (edited)

Hello guys, help me pls.

i have 2d array [5] [5]  with elements values 1-5 (random). How can i count elements (1- 10 times 2-eight times etc.) and search max quantity of element of the same type - "max quantity of 5 - $..." or another.

Edited by Martzen

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

hello Martzen, welcome to AutoIt and to the forum!

this sounds somewhat like a school task to me; and since we encourage ourselves to explore on our own, why won't you search the help file for various loop types AutoIt has to offer. at least try to construct some basic code, then post it here for some more specific advice.

Edited by orbs

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

dim $arr[8][8]

for $i=0 to 7
   for $j=0 to 7
      $arr[$i][$j] = PixelGetColor($Xcord + 49*$j,$Ycord + 49*$i)
   Next
next

PixelGetColor value can be 5 types (colors) like in game to solve 3 inline or in a column of the same type.

And i have array with random values like "red green blue blue green gray blue yellow etc"

question:

How many "Green" elements in array and max quantity of the same type.

Maximum quantity of same elements is - "red meets 25 times" for example...

Unfortunatly i not found similar question, sry.

Edited by Martzen

Share this post


Link to post
Share on other sites

well, as so often happens, you must have missed the forum rules on your way in. have a look at them now; there's a link at the bottom-right corner of each page.

in short, game automation is not allowed here. but i'm sure you are smart enough to figure it out - no-one is stopping you from putting some thought into it, but on your own.

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