THE BOOK cover
The Unwritten Book is Finally Written!
An in-depth analysis of: The sacrifice bunt, batter/pitcher matchups, the intentional base on balls, optimizing a batting lineup, hot and cold streaks, clutch performance, platooning strategies, and much more.
Read Excerpts & Customer Reviews

Buy The Book from Amazon


SABR101 required reading if you enter this site. Check out the Sabermetric Wiki. And interesting baseball books.
MOST RECENT ARTICLES
MAIL : You ask | We say

Advanced


THE BOOK--Playing The Percentages In Baseball

Filter posts by...

 

Wednesday, September 29, 2010

The Perfect Run Modeler - Perl version

By Tangotiger, 03:46 PM

Excellent!

By the way, bad programming on my part in not creating arrays.  There was a good (bad) reason for that.  Originally, my Markov calculator was just for me as an Excel spreadsheet.  And, if you can imagine, it was hard to follow.  Anyway, being lazy, I wanted to port that to Javascript with as little manual intervention as possible.  So, I converted all the formulas in the spreadsheet into text, which I then just copied over to a text file, made a few changes, and voila, Javascript.

After I did that, it was so obvious that I should have turned it into arrays.  For example, this is b.s. programming on my part:
state_1b_0_0
It should be:
state_bro[1][0][0]

Anyway, any of you math teachers out there who want to have a good programming example that uses baseball for your kids, I would recommend this.  It’s got alot of good stuff in it, and you can get them to turn the code into arrays, and, if you want to have fun, tell them to do this: assume there are n-outs in an inning, and m-bases.

Thanks to Sobchak for rewriting it.  You can view my original Javascript code by going to my Markov page and doing “view source”.

Page 1 of 1 pages

Latest...

COMMENTS

May 26 11:15
What makes for a successful GM?

May 26 07:27
“Why Kickstarter works”

May 26 03:03
Pete Palmer’s new book: Basic Ball

May 26 01:11
Largest demonstration in Canadian history?

May 25 19:41
What sabermetrics is NOT

May 25 16:59
Howard Stern

May 25 15:12
Do pitcher’s reach back for velocity when needed?

May 25 12:51
Chad Curtis

May 25 11:26
Lack of hustle during a game

May 25 10:58
Rooting for laundry

THREADS

September 29, 2010
The Perfect Run Modeler - Perl version