My DiariesA Lurid Tale of Obsession, Depravity, Wits and Attempted WitSun Jan 31, 1999Perl script to verify car data |
[Previous Entry ] [Thread List ] [Search ] [game logs ] [Next Entry ] [email] [Disclaimers]
<<-- Car Information -->>Copyright © 1999,2000, the author/owner of the following ==> page <==.
Based on mail to Nick. |
In the data for http://www.ent.ohiou.edu/~albrnick/gt/cgi-bin/sim-cars.cgi there seem to be some inconsistencies. |
I used: |
#!/bin/csh -f lynx -source http://www.ent.ohiou.edu/~albrnick/gt/cgi-bin/sim-cars.cgi -post_data <<EOF show=manu&show=cdt&show=cshp&show=csw&show=csr&show=cmhp&show=cmw&show=cmr&num_cars=1000&order=0&key=cshp&test1=none&min1=&max1=&test2=none&min2=&max2=&Toyota=-1&Mitsubishi=-1&Aston+Martin=-1&Nissan=-1&Honda%2FAcura=-1&Dodge=-1&Subaru=-1&Chevrolet=-1&TVR=-1&Mazda=-1&Prize+Cars=-1 EOF ------------------------------------------------------------------------------- |
to dump data for all the cars, I believe. I then edited it into "lotus form", sort of. |
I then ran it through the following Perl script: |
#!/xhbin/perl5 while ( <> ) { $_ =~ s/\n//g; @original = split(/,/); @fields = @original; foreach $f (@fields) { if ( $f =~ /---/) { $f = -1; } } # printf ( "%s,%s,%s,%s,%s,%s,%s,%s,%s\n", (@fields) ); # print $#fields, ","; ($name,$mfr,$drive,$stockbhp,$stocklb,$stockrat,$maxbhp,$maxlb,$maxrat) = @fields; $alert1 = ""; $alert2 = ""; $gsrat = $stockbhp / $stocklb; if ( $stocklb > 0 && abs( $gsrat - $stockrat ) > .001 ) { $alert1 = sprintf(",** stock ratio ** $stockrat should be %0.3f", $gsrat); } $gmrat = $maxbhp / $maxlb; if ( $maxlb > 0 && abs( $gmrat - $maxrat ) > .001 ) { $alert2 = sprintf(",** maxed ratio ** $maxrat should be %0.3f", $gmrat ); } printf("%s,%s,%s,%s,%s,%s,%s,%s,%s", (@original) ); printf("%s%s\n", $alert1,$alert2 ); } ------------------------------------------------------------------------------- |
[Previous Entry ] [Thread List ] [Search ] [game logs ] [Next Entry ] [email] [Disclaimers]
Copyright © 1999,2000 the author/owner of the following ==> page <==.