|
|
|
Clear questions and runnable code get the best and fastest answer |
|
| PerlMonks |
(arturo) Re: Baseball line up (best rotation)by arturo (Vicar) |
| on May 17, 2001 at 16:39 UTC ( [id://81296]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
To do this I would use a DBMS. Yes, you can do it in Perl data structures but if you start out even on this simple project with a hand-rolled solution, you'll end up tearing your hair out when you add features later. (I can easily see any app you'd develop for this specific purpose growing into a general statistical database for the league. Really!) Fear not, MySQL and PostgreSQL are available for the cost of a download and if you're running a free *nix (linux, bsd), you've probably got it installed already. Learn SQL. Get a copy of Programming the Perl DBI and write a DBI application that manipulates a relational database. That's short on specifics. I'd actually written somethign about the likely table structure, but my browser crashed. Let's just say you'd want a table for teams, players, and one for at bats. In the 'at bats' table, you store the game, the inning, the batter, the pitcher, the result (walk, strikeout, single, etc.) and the highest base reached. Then you could find out the number of singles Joe's hit against Sue with SQL like
The SQL for averages would be more complex, but I don't have time to think it out. This could be a *really fun* project, IMO.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||