Nice!
Let me contribute by pollishing up the look of your script (you deserve this):
(just replace your comments and the
use Tk;
before them with this...)
use Getopt::Long;
use Pod::Usage;
use Tk;
my $VERSION='1.00';
=pod
=head1 NAME
[ TkRollerCoaster.pl ]
=head1 DESCRIPTION
There was an "advanced perl programming" weekly contest awhile back(
+now defunct I think".
One I entered was a roller coaster simulation. The original contest h
+ad various *.rc files
to make any kind of coaster track design. I just included a nice one
+in DATA, to make the script self-contained.
This approach is a very simple method to simulate
the roller-coaster motion. I didn't waste any time
on actually computing the velocities or positions,
rather I relied on the Law of Conservation of Energy,
which says that the sum of the Kinetic and Potential
Energies will remain constant. The initial total energy
is the potential energy at the highest point, and that
is released into kinetic energy( i.e. velocity) as the
coaster drops. So as the coaster drops,
it's KE increases, and as the coaster climbs it's KE
decreases, and stalls if it climbs past it's start height.
I figured this was the best approach, since we don't have
an actual equation to differentiate to get the instantaneous
values. So this is not mathematically exact, it ignores the
constants in favor of better animation.
After all, it's just a visual simulation,
=head2 OPTIONS AND ARGUMENTS
(-)-h(elp) Help: shows these options
(-)-m(an) man : shows this pod
(-)-v(ersion) print Modules, Perl, OS, Program info
=item B<--version o -v>
Prints module && script versions
=item B<man>
Man: shows these options
=item B<help>
Help: shows this pod
=back
=head1 SYNOPSIS
Roller Coaster
=head1 SCRIPT CATEGORIES
fun
=head1 OSNAMES
any
=head1 AUTHOR
zentara #http://perlmonks.org/index.pl?node_id=131741# << zentara@zen
+tara.net >> ~ Aug 09, 2005 at 15:03 ART (#482340)~
=cut
my ($opt_help, $opt_man, $opt_versions);
GetOptions(
## EXPECTED GETOPT: ! JUST MENTION THE WORD
'help!' => \$opt_help,
'man!' => \$opt_man,
'versions!' => \$opt_versions,
) or
pod2usage(-verbose => 1 ) && exit; ## EXIT WITH SOME INFO
pod2usage(-verbose => 1) && exit if defined $opt_help;
pod2usage(-verbose => 2) && exit if defined $opt_man;
if(defined $opt_versions)
{
print
"\nModules, Perl, OS, Program info:\n",
" Pod::Usage $Pod::Usage::VERSION\n",
" Getopt::Long $Getopt::Long::VERSION\n",
" strict $strict::VERSION\n",
" Perl $]\n",
" OS $^O\n",
" TkRolerCoaster.pl $VERSION\n",
" $0\n",
"\n\n";
exit;
}
Then it looks more professional, don't you think so?
Thank you!