aboutsummaryrefslogtreecommitdiff
path: root/challenge-027
diff options
context:
space:
mode:
authorYsmael Ebreo <Ysmael.Ebreo@latticesemi.com>2019-10-01 00:25:57 +0800
committerYsmael Ebreo <Ysmael.Ebreo@latticesemi.com>2019-10-01 00:25:57 +0800
commitbf388cd040b2f2b4a4a1d1cab546145af126d4fd (patch)
treeffa96456f785e5ace2bb134e75c22fcdc9e052f4 /challenge-027
parent381e5595b5af5ae20d461e4035c68ac390c13ab8 (diff)
downloadperlweeklychallenge-club-bf388cd040b2f2b4a4a1d1cab546145af126d4fd.tar.gz
perlweeklychallenge-club-bf388cd040b2f2b4a4a1d1cab546145af126d4fd.tar.bz2
perlweeklychallenge-club-bf388cd040b2f2b4a4a1d1cab546145af126d4fd.zip
Updated solution for ch#27-1
Diffstat (limited to 'challenge-027')
-rw-r--r--challenge-027/yet-ebreo/perl5/ch-1.pl14
1 files changed, 14 insertions, 0 deletions
diff --git a/challenge-027/yet-ebreo/perl5/ch-1.pl b/challenge-027/yet-ebreo/perl5/ch-1.pl
index de535cfb25..8a298f4b09 100644
--- a/challenge-027/yet-ebreo/perl5/ch-1.pl
+++ b/challenge-027/yet-ebreo/perl5/ch-1.pl
@@ -48,6 +48,20 @@ if ($x_delta2) {
#Lines are parallel if slopes are equal
if ($slope1 == $slope2) {
say "Two given lines are parallel"
+} elsif ($ARGV[0] == $ARGV[2]) {
+ # X is either X11($ARGV[0]) or X12($ARGV[2])
+ # Y is equal to mX + b with:
+ # m = slope of the second line ($slope2)
+ # X = as defined above
+ # b = Y intercept of second line ($y_intercept2)
+ say( ($ARGV[0]).",".($slope2*$ARGV[0]+$y_intercept2) );
+} elsif ($ARGV[4] == $ARGV[6]) {
+ # X is either X21($ARGV[4]) or X22($ARGV[6])
+ # Y is equal to mX + b with:
+ # m = slope of the first line ($slope1)
+ # X = as defined above
+ # b = Y intercept of first line ($y_intercept1)
+ say( ($ARGV[4]).",".($slope1*$ARGV[4]+$y_intercept1) );
} else {
#Solve the linear equation using determinants
# | x1 y1 |