Sign in to follow this  
Followers 0
steph1

help with arrays pls

3 posts in this topic

I have a perl program that reads a file with baseball scores and calculates pointsFor/pointsAgainst for each team. I would like to rewrite this program in autoit. Problem I am having is adding each teams points (pf/pa) to an array.

was 12 at tor 2

sea 7 at kc 2

pit 2 at phi 7

etc..

....

....

Each line is split by team1 score1 where team2 score2

in perl i use

$scorePF{$team1} += $score1; add pointsFor whatever the team1 name is on the line

$scorePA{$team1} += $score2; add pointsAgainst for team1

$scorePF{$team2} += $score2;

$scorePA{$team2} += $score1;

Is there a way to do this in autoit or do I have to create a variable for each team/PF/PA.

I am still a beginner here in both languages lol, so go easy on me.

Thanks

steph1

Share this post


Link to post
Share on other sites



You can certainly create a 2D array, with n rows and 3 columns, where n = number of teams and the columns are:

[n][0] = team name, i.e. "was"

[n][1] = points for

[n][2] = points against

In the loop where you evaluate each line of data, you would search column 0 for each team name to get the row index, and then add points to either [n][1] or [n][2],

:blink:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

You can certainly create a 2D array, with n rows and 3 columns, where n = number of teams and the columns are:

[n][0] = team name, i.e. "was"

[n][1] = points for

[n][2] = points against

In the loop where you evaluate each line of data, you would search column 0 for each team name to get the row index, and then add points to either [n][1] or [n][2],

:blink:

Thanks PsaltyDS for your help, I'll give it a try

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