Class: SmartRule

SmartRule

SmartRule class.

Constructor

new SmartRule()

The SmartRule static class contains methods that return a function along with its closure.
Version:
  • 2017-03-27
Author:
Source:

Methods

(static) getInOppositeGroup(puzzle, rule, noun1, noun2, nounType, map, groupName, groupNames) → {function}

Returns the inOppositeGroup function to enforce the rule where noun1 and noun2 are not in the same group. See puzzles: Big5GameRangers
Parameters:
Name Type Description
puzzle Puzzle Puzzle object.
rule Rule Rule.
noun1 Noun Noun 1.
noun2 Noun Noun 2.
nounType NounType Noun type.
map Array Array of numbers.
groupName string Group name.
groupNames Array Array of group names.
Source:
Returns:
Function inOppositeGroup.
Type
function

(static) getInSameGroup(puzzle, rule, noun1, noun2, nounType, map, groupName, groupNames) → {function}

Returns the inSameGroup function to enforce the rule where noun1 and noun2 are in the same group. See puzzles: Big5GameRangers
Parameters:
Name Type Description
puzzle Puzzle Puzzle object.
rule Rule Rule.
noun1 Noun Noun 1.
noun2 Noun Noun 2.
nounType NounType Noun Type.
map Array Array of numbers.
groupName string Group name.
groupNames Array Array of group names.
Source:
Returns:
Function inSameGroup.
Type
function

(static) getIsNotBetween(puzzle, rule, nounType, noun1, noun2, noun3) → {function}

Returns the isNotBetween function to enforce the rule where noun1 is not between noun2 and noun3, where any two nouns may be slots. Assumes the slots are ordered by number (either low to high or high to low). See puzzles: AllTiredOut.
Parameters:
Name Type Description
puzzle Puzzle Puzzle object.
rule Rule Rule.
nounType NounType Noun type.
noun1 Noun Noun 1.
noun2 Noun Noun 2.
noun3 Noun Noun 3.
Source:
Returns:
Function isNotBetween.
Type
function

(static) getIsRelated(puzzle, rule, noun1, link, nouns2) → {function}

Returns the isRelated function to enforce the rule where noun1 is related to at least one noun in nouns2. See puzzles: AllTiredOut
Parameters:
Name Type Description
puzzle Puzzle Puzzle object.
rule Rule Rule.
noun1 Noun Noun 1.
link Link Link.
nouns2 Array Array of nouns.
Source:
Returns:
Function isRelated.
Type
function

(static) getMatchAtLeastOne(puzzle, rule, noun1, nouns2) → {function}

Returns the matchAtLeastOne function to enforce rule where noun1 is with at least one noun in nouns2. See puzzles: AtTheAlterAltar, DogDuty, ModernNovels, PsychicPhoneFriends.
Parameters:
Name Type Description
puzzle Puzzle Puzzle object.
rule Rule Rule.
noun1 Noun Noun 1.
nouns2 Noun Noun 2.
Source:
Returns:
Function matchAtLeastOne.
Type
function

(static) getMatchOneList(puzzle, rule, nouns1, array2) → {function}

Returns the matchOneList function to enforce the rule where the nouns in nouns1 must be with one list of nouns in array2. See puzzles: Overdue, PlayingCards.
Parameters:
Name Type Description
puzzle Puzzle Puzzle object.
rule Rule Rule.
nouns1 Array Array of nouns.
array2 Array 2D array of nouns.
Source:
Returns:
Function matchOneList.
Type
function

(static) getMatchOneToExactlyOne(puzzle, rule, nouns1, nouns2) → {function}

Returns the matchOneToExactlyOne function to enforce rule where exactly one noun in nouns1 is with exactly one noun in nouns2. See puzzles: ModernNovels.
Parameters:
Name Type Description
puzzle Puzzle Puzzle object.
rule Rule Rule.
nouns1 Array Array of nouns.
nouns2 Array Array of nouns.
Source:
Returns:
Function matchOneToExactlyOne.
Type
function

(static) getMatchOneToOne(puzzle, rule, nouns1, nouns2) → {function}

Returns the matchOneToOne function to enforce rule where each noun in nouns1 is uniquely matched with one noun in nouns2. See puzzles: ModernNovels, SmallTownMotels.
Parameters:
Name Type Description
puzzle Puzzle Puzzle object.
rule Rule Rule.
nouns1 Array Array of nouns.
nouns2 Array Array of nouns.
Source:
Returns:
Function matchOneToOne.
Type
function