 |
Exercise 17: Implement SolveConditions
Summary
Input:
  | A rule, with 1 or more conditions. |
  | A hash to be used to store variable values. Initially it is only populated with the values of variables that could be determined by comparing the rule conclusion to what is to be derived. |
Output:
  | A list of hashes. Each hash represents a complete set of variable values that satisfy all conditions. |
Step 1:
Iteratively solve all conditions that have only variables with known values. If any of the conditions fails, then return an empty list.
Step 2:
Iteratively solve all conditions with a single unresolved variable using SolveCondition. For each hash returned from SolveCondition, recurse. Add each hash returned from our recurse to our output.
Step 3:
Iteratively solve all conditions with two unresolved variables. If a condition fails to solve, then try the next one, so on and so forth. If none of the two-variable conditions resolve, then return an empty list. |
|
 |