Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

learns -m flag to select minimum multiplier

  • Loading branch information...
commit 7f1e5412bdf436ebbb699f7bf7263e55fcdd40d5 1 parent 44e4e2c
@mjdominus authored
Showing with 6 additions and 3 deletions.
  1. +6 −3 mathpuzzle.pl
View
9 mathpuzzle.pl
@@ -3,9 +3,12 @@
use POSIX qw(ceil);
use Getopt::Std;
+# -m min-multiplier
# -M max-multiplier
-my %opt = (M => 3, A => 9, z => 0);
-getopts('zM:A:', \%opt) or die "Usage\n";
+# -A max summand in + and -
+# -z allow 0 as a summand
+my %opt = (m => 2, M => 3, A => 9, z => 0);
+getopts('zm:M:A:', \%opt) or die "Usage\n";
my @pats = ([qw(a b * x /)],
[qw(a * b x /)],
@@ -21,7 +24,7 @@
);
# select multipliers
-my @multipliers = select_multipliers(4, 2, $opt{M});
+my @multipliers = select_multipliers(4, $opt{m}, $opt{M});
# for each group, pick a, b at random, either positive or negative
# generate five values, including calculation of x
Please sign in to comment.
Something went wrong with that request. Please try again.