Skip to content
Butitsnotme edited this page Oct 6, 2016 · 2 revisions

Welcome to the funky-math-problem-solver wiki!

Help Information

dennis@dennis-laptop:~$ fmps --help
  fmps {OPTIONS} [rules...]

    solves the new funky math problem found in uWaterloo mathNEWS publication.
    Pass the program the size (defaults to 6) and the set of rules/restrictions,
    if there is a valid solution, it will be printed out.
    Rules are in the following format:
    <x1>:<y1>:<x2>:<y2>:<rule>
    Where:
    <x1> - The horizontal index of the first box affected by the rule.
    <y1> - The vertical index of the first box affected by the rule.
    <x2> - The horizontal index of the second box affected by the rule.
    <y2> - The vertical index of the second box affected by the rule.
    <rule> - The rule, either "<", ">" or a number for the absolute difference
    Note: Boxes are zero indexed, beggining with the upper left box.
    Example:
    0:1:0:2:3 - The first two boxes of the first column must have a difference
    of 3

  OPTIONS:

      --license                         Show the license
      -h, --help                        Display this help text
      --version                         Show the program version
      -s[size], --size=[size]           Set the size of the grid
      -a, --all                         Find all solutions, not just the first
      -c, --count                       Only count the solutions, do not print
                                        them
      -m, --metrics                     Output some metrics about the
                                        solution(s)
      rules...                          The list of constraints/rules
      "--" can be used to terminate flag options and force all following
      arguments to be treated as positional options

Example

Here is an example run:

dennis@dennis-laptop:~$ fmps "0:0:1:0:>" "2:0:3:0:>" "4:0:5:0:>" 2:1:3:1:4 "0:1:0:2:>" "5:1:5:2:>" 0:2:0:3:1 "2:2:2:3:>" "3:2:3:3:>" 5:2:5:3:1 "0:3:0:4:>" "5:3:5:4:>" "2:4:2:5:>" "3:4:3:5:>" 0:5:1:5:1 1:5:2:5:2 2:5:3:5:3 3:5:4:5:2 4:5:5:5:1
Size: 6
 Rule | x   | y
 ----------------
 >    | 0.5 | 0
 >    | 2.5 | 0
 >    | 4.5 | 0
 4    | 2.5 | 1
 >    | 0 | 1.5
 >    | 5 | 1.5
 1    | 0 | 2.5
 >    | 2 | 2.5
 >    | 3 | 2.5
 1    | 5 | 2.5
 >    | 0 | 3.5
 >    | 5 | 3.5
 >    | 2 | 4.5
 >    | 3 | 4.5
 1    | 0.5 | 5
 2    | 1.5 | 5
 3    | 2.5 | 5
 2    | 3.5 | 5
 1    | 4.5 | 5
Solution found
6 > 2   5 > 3   4 > 1   
                        
4   3   1 4 5   2   6   
>                   >   
2   5   3   6   1   4   
1       >   >       1   
3   1   2   4   6   5   
>                   >   
1   4   6   2   5   3   
        >   >           
5 1 6 2 4 3 1 2 3 1 2 
Clone this wiki locally