Ruby Football

I wrote this quickie to pull names out of a hat to choose the order of our Fantasy Football draft. It ended up being way shorter than what I originally wrote. Sadly, I didn’t keep the original version. In five minutes or so I went through at least six or seven iterations. Go football!

The hat:
puts ARGV.delete_at(rand(ARGV.length)) until ARGV.length == 0

A demo:
cmcavoy@aubrey:~/projects$ ruby football_hat.rb huey dewey louie cat dog mouse
huey
dewey
cat
dog
mouse
louie

Over the weekend, I spent an hour or so playing around with getting a bunch of CSV files from a football statistics site into MySQL via ActiveRecord. Although I know you can use ActiveRecord outside of Rails, I thought I’d just build the scripts inside a Rails app. I checked it into my public repository here http://www.lonelylion.com/mcavoy_public/footballs/trunk/

Because of the limited number of games in a season, football doesn’t bear up to intense statistical analysis the way baseball does. The only sort of stats’y thing I’d like to run against this database is classifying teams as throwing or running teams. It’s kind of trivial, and most of the magazines cover that, so it’s sort of pointless, but…meh…football!

1 Response to “Ruby Football”


  1. 1 Chris

    This is almost exactly what I’ve been looking for. Thanks. I’m in the process of writing a fantasy drafting program in Ruby and have been searching for stats from last year. Ideally, it will be interactive, prompting players for their picks, but allowing for queries like whether a player is still available to be drafted, when bye weeks are, etc. I don’t know whether I’ll have time to do it between now and the end of the month, but we’ll see. Thanks again.

Leave a Reply

You must login to post a comment.




Proxy surf mp3 site mp3 sites