Jump to content

2d array element count


Recommended Posts

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
Link to comment
Share on other sites

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

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

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
Link to comment
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.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...