From d92a61c5c00f3d2233d65d43a1d417baab33466c Mon Sep 17 00:00:00 2001 From: Nezumi Ronin Date: Tue, 23 Mar 2021 02:38:27 -0600 Subject: [PATCH] Create kinema.pl Made with Perl! --- 52 Kinema/perl/kinema.pl | 53 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 52 Kinema/perl/kinema.pl diff --git a/52 Kinema/perl/kinema.pl b/52 Kinema/perl/kinema.pl new file mode 100644 index 00000000..ef607983 --- /dev/null +++ b/52 Kinema/perl/kinema.pl @@ -0,0 +1,53 @@ +#!/usr/bin/perl +use strict; + + +print ' 'x 33 . "KINEMA\n"; +print ' 'x 15 . "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\n"; +print "\n\n\n"; + +while (1) { + print "\n"; + print "\n"; + my $Q=0; + my $V=5+int(35*rand(1)); + print "A BALL IS THROWN UPWARDS AT $V METERS PER SECOND.\n"; + print "\n"; + + my $A=.05*$V^2; + print "HOW HIGH WILL IT GO (IN METERS)"; + $Q+= &Input($A); + + $A=$V/5; + print "HOW LONG UNTIL IT RETURNS (IN SECONDS)"; + $Q+= &Input($A); + + my $T=1+int(2*$V*rand(1))/10; + $A=$V-10*$T; + print "WHAT WILL ITS VELOCITY BE AFTER $T SECONDS"; + $Q+= &Input($A); + + print "\n"; + print "$Q RIGHT OUT OF 3."; + if ($Q<2) { next; } + print " NOT BAD.\n"; + } + +exit; + + +#Line500: +sub Input { + my ($A)= @_; + my $Point=0; + print "? "; chomp(my $G = ); + if (abs(($G-$A)/$A)<.15) { + print "CLOSE ENOUGH.\n"; + $Point=1; + } else { + print "NOT EVEN CLOSE....\n"; + } + print "CORRECT ANSWER IS $A\n"; + print "\n"; + return $Point; + }