diff options
| author | Saif Ahmed <34284663+saiftynet@users.noreply.github.com> | 2022-05-22 23:03:06 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-22 23:03:06 +0100 |
| commit | c971e42eedc84048088f4ba19a3f7b29e57dcecf (patch) | |
| tree | dc189eb678810c8cb08b07fabb5c8cabe9270ae5 /challenge-165 | |
| parent | dedeede73a16968f0036e56863227c5b029388d8 (diff) | |
| download | perlweeklychallenge-club-c971e42eedc84048088f4ba19a3f7b29e57dcecf.tar.gz perlweeklychallenge-club-c971e42eedc84048088f4ba19a3f7b29e57dcecf.tar.bz2 perlweeklychallenge-club-c971e42eedc84048088f4ba19a3f7b29e57dcecf.zip | |
Single solution to two challenges
Usage:
perl ch-1or2.pl.....solves challenge 1
perl ch-1or2.pl -i <inputfile> -l <0|off> ...uses data from input file, and does not draw line of best fit
Diffstat (limited to 'challenge-165')
| -rw-r--r-- | challenge-165/saiftynet/ch-1or2.pl | 4 | ||||
| -rw-r--r-- | challenge-165/saiftynet/in.dat | 8 |
2 files changed, 8 insertions, 4 deletions
diff --git a/challenge-165/saiftynet/ch-1or2.pl b/challenge-165/saiftynet/ch-1or2.pl index 7ed2680673..eb08094600 100644 --- a/challenge-165/saiftynet/ch-1or2.pl +++ b/challenge-165/saiftynet/ch-1or2.pl @@ -10,7 +10,8 @@ # Challenge two does the same but also draws the best fit straight line
# using least squares method. this is the default operation and uses data
-# provided
+# provided. Note if lines are included, they are drawn but not added to the data
+# for line of best fit
# Usage: ch-1or2.pl Default...just does challenge 2 using data in __DATA__
# ch-1or2.pl <-i inputFile> <-o outputfile> specify input and output files
@@ -93,6 +94,7 @@ sub bestFitLine{ }
# notice data can be spearted by spaces or new lines
+# lines are ignored for data for line of best fit
__DATA__
333,129 39,189 140,156 292,134 393,52 160,166 362,122 13,193
341,104 320,113 109,177 203,152 343,100 225,110 23,186 282,102
diff --git a/challenge-165/saiftynet/in.dat b/challenge-165/saiftynet/in.dat index a4098fc56d..b95799fa50 100644 --- a/challenge-165/saiftynet/in.dat +++ b/challenge-165/saiftynet/in.dat @@ -1,6 +1,8 @@ +data for inputing...this contains some lines as well. +text like this are ignored 333,129 39,189 140,156 292,134 393,52 160,166 362,122 13,193 -341,104 320,113 109,177 203,152 343,100 225,110 23,186 282,102 -284,98 205,133 297,114 292,126 339,112 327,79 253,136 61,169 +341,104 320,113 109,177 203,152 343,100,225,110 23,186 282,102 +284,98,205,133 297,114 292,126 339,112 327,79 253,136 61,169 128,176 346,72 316,103 124,162 65,181 159,137 212,116 337,86 -215,136 153,137 390,104 100,180 76,188 77,181 69,195 92,186 +215,136 153,137,390,104 100,180 76,188 77,181 69,195 92,186 275,96 250,147 34,174 213,134 186,129 189,154 361,82 363,89 |
