View Single Post
  #18   Spotlight this post!  
Unread 28-10-2016, 17:50
Rachel Lim Rachel Lim is offline
Registered User
FRC #1868 (Space Cookies)
Team Role: Student
 
Join Date: Sep 2014
Rookie Year: 2014
Location: Moffett Field
Posts: 244
Rachel Lim has a reputation beyond reputeRachel Lim has a reputation beyond reputeRachel Lim has a reputation beyond reputeRachel Lim has a reputation beyond reputeRachel Lim has a reputation beyond reputeRachel Lim has a reputation beyond reputeRachel Lim has a reputation beyond reputeRachel Lim has a reputation beyond reputeRachel Lim has a reputation beyond reputeRachel Lim has a reputation beyond reputeRachel Lim has a reputation beyond repute
Re: Google Sheets OPR Calculator

Quote:
Originally Posted by Ether View Post
Hi Rachel.

I think you missed the boat here.

Your code has three passes through the matches, and the final pass has an inner loop which loops through the teams.

The pseudo-code I posted does a single pass through the 8col match data, with no inner loops in that single pass. That single pass accomplishes everything you need.

Give it a try!
Yep...I realized what you meant after I posted it.

I also figured out what's taking so much time: it's the repeated .getRange().setValue(). There's another function, setValues() that allows me to print the entire array at once that really speeds it up.

However, the array must be a consistent size, so I had to keep the loop to create T so I could initialize A. It also seems like fill() doesn't work in scripts, so I had to loop through T to set A to zero, otherwise when I printed out A it'd be filled with "NOT_FOUND". I did cut out the loop for b (not sure why I had it there in the first place).

Although I did manage to implement your pseudo-code, the only method I found to make that work would be to print A directly (instead of creating the array first), which took longer than looping. It also results in the OPRs not being sorted, which is a convenience I'd sacrifice a bit of time for.

Hopefully that now addresses your point? I'll post my updated code once I clean it up a bit.
Reply With Quote