diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2019-09-30 01:19:30 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2019-09-30 01:19:30 +0100 |
| commit | 49a27c0b917251eb3ba7c19ea974976589696a03 (patch) | |
| tree | f5dcb50b732c3a4ce2cdf95da0d8a5cd8eb31544 /challenge-028/duncan-c-white | |
| parent | 7b6a046fc88bd54f7d426b4d0b07d58c22b148d5 (diff) | |
| download | perlweeklychallenge-club-49a27c0b917251eb3ba7c19ea974976589696a03.tar.gz perlweeklychallenge-club-49a27c0b917251eb3ba7c19ea974976589696a03.tar.bz2 perlweeklychallenge-club-49a27c0b917251eb3ba7c19ea974976589696a03.zip | |
- Added template for Challenge - 028.
Diffstat (limited to 'challenge-028/duncan-c-white')
| -rw-r--r-- | challenge-028/duncan-c-white/README | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/challenge-028/duncan-c-white/README b/challenge-028/duncan-c-white/README new file mode 100644 index 0000000000..69197e921e --- /dev/null +++ b/challenge-028/duncan-c-white/README @@ -0,0 +1,36 @@ +Challenge 1: "Write a script to find the intersection of two straight +lines. The co-ordinates of the two lines should be provided as command +line parameter. For example: + +The two ends of Line 1 are represented as co-ordinates (a,b) and (c,d). + +The two ends of Line 2 are represented as co-ordinates (p,q) and (r,s). + +The script should print the co-ordinates of point of intersection of +the above two lines." + +My notes: Clearly defined, very easy if I can remember the formulae - let's +have a go.. after doing it, I decided to run Gnuplot to display the results +as it's an intensely graphical concept.. + + +Challenge 2: "Write a script that allows you to capture/display historical +data. It could be an object or a scalar. For example + + my $x = 10; $x = 20; $x -= 5; + +After the above operations, it should list $x historical value in order." + +My notes: The idea is easy, but we're not told the API to implement. I'm +certainly not going to introspect into Perl to find out whenever a scalar +variable is assigned to! I have chosen to implement this for numeric +variables, using an input sequence of VARNAME OP VALUE triples (where OP='=', +'+=', '-=', '*=', '/=' or '%='), where each input triple N occurs at time N, +and we track the historic value of each variable over time. + +I did that, using __DATA__ (at the end of this file) for the default sequence, +or the contents of a named input file if given. + +I also graphed the time-series results via Gnuplot as I seem to be having +a Gnuplot kick this week:-) It's not really the ideal output format, but +it's relatively cute. |
