Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
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.


in reply to Baseball line up (best rotation)

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

SELECT count(*) FROM at_bat WHERE pitcher='Sue' AND batter='Joe' WHERE + result = 'single';

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.

perl -e 'print "How sweet does a rose smell? "; chomp ($n = <STDIN>); +$rose = "smells sweet to degree $n"; *other_name = *rose; print "$oth +er_name\n"'

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://81296]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.