all of these terms will be included in the
result. A match will be considered on any of
puzzle title, round title, puzzle URL, puzzle
- state or solution string. Terms can include
- regular expression syntax.
+ state, puzzle type, tags, or solution
+ string. Terms can include regular expression
+ syntax.
limit_to_rounds: A list of rounds. If provided only the given
rounds will be included in the output. Note:
character in a term). All terms must match on a puzzle in order
for that puzzle to be included. But a puzzle will be considered to
match if any of the puzzle title, round title, puzzle URL, puzzle
- state, or puzzle solution match. Matching will be performed
- without regard to case sensitivity and the search terms can
- include regular expression syntax.
+ state, puzzle type, tags, or puzzle solution match. Matching will
+ be performed without regard to case sensitivity and the search
+ terms can include regular expression syntax.
+
"""
channel_id = body['channel_id'][0]
"""Returns True if this puzzle matches the given string (regexp)
A match will be considered on any of puzzle title, round title,
- puzzle URL, puzzle state, or solution string. The string can
- include regular expression syntax. Matching is case insensitive.
+ puzzle URL, puzzle state, puzzle type, tags, or solution
+ string. The string can include regular expression syntax. Matching
+ is case insensitive.
"""
p = re.compile('.*'+pattern+'.*', re.IGNORECASE)
if p.match(puzzle['state']):
return True
+ if 'type' in puzzle:
+ if p.match(puzzle['type']):
+ return True
+
if 'solution' in puzzle:
for solution in puzzle['solution']:
if p.match(solution):
return True
+ if 'tags' in puzzle:
+ for tag in puzzle['tags']:
+ if p.match(tag):
+ return True
+
return False
def puzzle_matches_all(puzzle, patterns):
"""Returns True if this puzzle matches all of the given list of patterns
A match will be considered on any of puzzle title, round title,
- puzzle URL, puzzle state, or solution string. All patterns must
- match the puzzle somewhere, (that is, there is an implicit logical
- AND between patterns). Patterns can include regular expression
- syntax. Matching is case insensitive.
+ puzzle URL, puzzle state, puzzle types, tags, or solution
+ string. All patterns must match the puzzle somewhere, (that is,
+ there is an implicit logical AND between patterns). Patterns can
+ include regular expression syntax. Matching is case insensitive.
+
"""
for pattern in patterns: