Skip to content

Commit

Permalink
learns -m flag to select minimum multiplier
Browse files Browse the repository at this point in the history
  • Loading branch information
mjdominus committed Mar 25, 2015
1 parent 44e4e2c commit 7f1e541
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions mathpuzzle.pl
Expand Up @@ -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 /)],
Expand All @@ -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
Expand Down

0 comments on commit 7f1e541

Please sign in to comment.