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!

{ \ ( ' v ' ) / }
( \ _ / ) _ _ _ _ ` ( ) ' _ _ _ _
( = ( ^ Y ^ ) = ( _ _ ^ ^ ^ ^
_ _ _ _ \ _ ( m _ _ _ m ) _ _ _ _ _ _ _ _ _ ) c h i a n o , a l b e r t o
Wherever I lay my KNOPPIX disk, a new FREE LINUX nation could be established

In reply to Re: ztk-roller-coaster-simulation by chanio
in thread ztk-roller-coaster-simulation by zentara

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.