Saturday, March 28, 2015

Batting Order Rotation

Thanks to this code that I borrowed, I was able to create a batting order rotator for my son's Tee Ball team.

You can see it in action here.

I can see how this might be useful for elementary classes that want to rotate line leader and class jobs frequently through the day etc. etc. and also possibly in high school for seating charts (although there's other programs for that--usually attached to your grade book program) or for lab work in science class and things of that nature.

It surely would have taken me 1000 years of study to get to those few lines of code in JavaScript to rotate an array (the ones in there with the % sign I think are the trick, if I understand what I'm looking at!).  I was doing it just fine in a spread sheet thanks to this video, however, pulling from a live spreadsheet and displaying on a web page was beyond my skills at the moment and seemed like too many steps.  Then I thought I could create an array pretty easily in JavaScript and it should be a sinch to essentially follow the same neat procedures from that youTube video to lookup the correct index for each new batter.