DEV Community

Alex Towell
Alex Towell

Posted on • Originally published at metafunctor.com

Fuzzy Inference: Teaching Machines to Think in Shades of Grey

Facts and Degrees

In classical logic, something is true or false. The cat is on the mat, or it is not. A patient has a fever, or they do not. There is no middle ground.

Fuzzy logic adds a dial.

Instead of true/false, every statement carries a degree of belief -- a number between 0 and 1. A degree of 1.0 means certainty. A degree of 0.0 means we have no belief at all. And everything in between is fair game.

Here is the simplest possible fuzzy fact:

# A fuzzy fact: "Rex has hair" with 85% confidence
engine.add_fact("has-hair", ["rex"], 0.85)
Enter fullscreen mode Exit fullscreen mode

The predicate is has-hair. The argument is rex. The degree is 0.85. Maybe we observed Rex from a distance, or the photo was blurry. We are fairly sure Rex has hair, but not certain.

This is the building block of everything that follows. A fuzzy knowledge base is just a collection of these facts, each with its own degree. Some facts we are sure about (deg=1.0). Others are tentative guesses (deg=0.3). The engine treats them all the same way -- it just pays attention to the number.

One important detail: when two sources assert the same fact with different degrees, the engine keeps the higher one. This is called fuzzy-OR. If one sensor says has-hair(rex) at 0.85 and another says it at 0.92, the engine stores 0.92. Optimistic, but reasonable -- the stronger evidence wins.

engine.add_fact("has-hair", ["rex"], 0.85)
engine.add_fact("has-hair", ["rex"], 0.92)  # fuzzy-OR: keeps 0.92
Enter fullscreen mode Exit fullscreen mode

In the widget below, you can create fuzzy facts and drag the degree slider to see how the degree changes the visual representation. A fact at 1.0 is solid and bright. A fact at 0.1 is faded, barely there. This is not just decoration -- it is the engine's uncertainty, made visible.

Rules

Facts alone are inert. To reason, we need rules -- if-then statements that produce new facts from existing ones.

A fuzzy rule looks like this: "If X has hair, then X is a mammal." In code:

engine.add_rule(
    name="mammal-rule",
    conditions=[{"pred": "has-hair", "args": ["?x"], "degVar": "?d"}],
    actions=[{
        "type": "add",
        "fact": {"pred": "is-mammal", "args": ["?x"], "deg": ["*", 0.95, "?d"]}
    }],
    priority=60,
)
Enter fullscreen mode Exit fullscreen mode

There is a lot going on here, so let us unpack it.

Pattern variables. The ?x in the condition is a variable. It matches any argument. When the engine finds has-hair(rex, 0.85), it binds ?x to rex. The same ?x then appears in the action, so the engine adds is-mammal(rex, ...).

Degree variables. The ?d captures the degree of the matched fact. If has-hair(rex) has degree 0.85, then ?d binds to 0.85.

Degree expressions. The action's degree is ["*", 0.95, "?d"] -- multiply 0.95 by whatever ?d is. So if Rex's hair-having is 0.85, his mammal-hood is 0.95 * 0.85 = 0.8075. The 0.95 factor represents the rule's own confidence. Having hair is strong evidence of being a mammal, but not perfect -- a few non-mammals have hair-like structures.

Priority. Rules have priorities. Higher-priority rules fire first. Base classification rules (mammal, bird, carnivore) run at priority 60. Intermediate classes run at 50. Species identification at 40. This lets the engine build up intermediate concepts before trying to identify specific species.

Rules can also require multiple conditions. Here is the carnivore rule:

engine.add_rule(
    name="carnivore-rule",
    conditions=[
        {"pred": "eats-meat", "args": ["?x"], "degVar": "?d1"},
        {"pred": "has-claws", "args": ["?x"], "degVar": "?d2"},
    ],
    actions=[{
        "type": "add",
        "fact": {
            "pred": "is-carnivore",
            "args": ["?x"],
            "deg": ["*", 0.9, ["min", "?d1", "?d2"]],
        },
    }],
    priority=60,
)
Enter fullscreen mode Exit fullscreen mode

Two conditions, two degree variables. The degree expression takes the minimum of the two input degrees -- the weakest link -- then multiplies by 0.9. If we are 90% sure something eats meat but only 60% sure it has claws, the carnivore degree is 0.9 * min(0.9, 0.6) = 0.54. The chain is only as strong as its weakest evidence.

Try toggling conditions and adjusting degrees in the widget below to see how rules fire and propagate.

Forward Chaining

Individual rules are useful, but the real power comes from chaining them together. The engine runs in a loop:

  1. Scan all rules. For each rule, find all variable bindings that satisfy its conditions.
  2. For each match, check if this (rule, bindings) pair has fired before. If not, execute the actions.
  3. If any new facts were added or changed, go back to step 1.
  4. Stop when nothing changes, or when a maximum iteration count is reached.

This is called forward chaining -- start from known facts and chain forward through rules until no more conclusions can be drawn. The engine keeps going until nothing new is learned.

Here is the complete engine. It is about 100 lines of Python:

"""Forward-chaining fuzzy inference engine in ~100 lines of Python."""

from __future__ import annotations
import json
from typing import Any


def _clamp01(n: float) -> float:
    return max(0.0, min(1.0, n))


def _eval_degree(expr: Any, bindings: dict[str, Any]) -> float:
    """Evaluate a degree expression and clamp to [0, 1]."""
    if isinstance(expr, (int, float)):
        return _clamp01(expr)
    if isinstance(expr, str) and expr.startswith("?"):
        return _clamp01(float(bindings.get(expr, 0)))
    if isinstance(expr, list):
        op, *operands = expr
        vals = [_eval_degree_raw(o, bindings) for o in operands]
        if op == "*":
            r = 1.0
            for v in vals:
                r *= v
            return _clamp01(r)
        if op == "+":
            return _clamp01(sum(vals))
        if op == "-":
            return _clamp01(vals[0] - sum(vals[1:]))
        if op == "/":
            return _clamp01(vals[0] / vals[1]) if vals[1] != 0 else 0.0
        if op == "min":
            return _clamp01(min(vals))
        if op == "max":
            return _clamp01(max(vals))
    return 0.0


def _eval_degree_raw(expr: Any, bindings: dict[str, Any]) -> float:
    """Evaluate without clamping (for nested intermediate results)."""
    if isinstance(expr, (int, float)):
        return float(expr)
    if isinstance(expr, str) and expr.startswith("?"):
        return float(bindings.get(expr, 0))
    if isinstance(expr, list):
        op, *operands = expr
        vals = [_eval_degree_raw(o, bindings) for o in operands]
        if op == "*":
            r = 1.0
            for v in vals:
                r *= v
            return r
        if op == "+":
            return sum(vals)
        if op == "-":
            return vals[0] - sum(vals[1:])
        if op == "/":
            return vals[0] / vals[1] if vals[1] != 0 else 0.0
        if op == "min":
            return min(vals)
        if op == "max":
            return max(vals)
    return 0.0


class FuzzyEngine:
    """Forward-chaining fuzzy inference engine."""

    def __init__(self):
        self.facts: dict[tuple, float] = {}  # (pred, *args) -> degree
        self.rules: list[dict] = []
        self._fired: set[str] = set()

    def add_fact(self, pred: str, args: list[str], deg: float = 1.0) -> None:
        key = (pred, *args)
        self.facts[key] = max(self.facts.get(key, 0.0), deg)  # fuzzy-OR

    def add_rule(
        self, name: str, conditions: list[dict], actions: list[dict], priority: int = 50
    ) -> None:
        self.rules.append(
            {"name": name, "conditions": conditions, "actions": actions, "priority": priority}
        )
        self.rules.sort(key=lambda r: -r["priority"])

    def query(self, pred: str) -> list[tuple[tuple, float]]:
        return [(k, v) for k, v in self.facts.items() if k[0] == pred]

    def _match_condition(
        self, cond: dict, bindings: dict[str, Any]
    ) -> list[tuple[dict[str, Any], float]]:
        results = []
        cpred, cargs = cond["pred"], cond["args"]
        for (pred, *args), deg in list(self.facts.items()):
            if pred != cpred or len(args) != len(cargs):
                continue
            b = dict(bindings)
            ok = True
            for pat, val in zip(cargs, args):
                if pat.startswith("?"):
                    if pat in b:
                        if b[pat] != val:
                            ok = False
                            break
                    else:
                        b[pat] = val
                elif pat != val:
                    ok = False
                    break
            if not ok:
                continue
            if "degVar" in cond and cond["degVar"]:
                b[cond["degVar"]] = deg
            results.append((b, deg))
        return results

    def _satisfy_all(self, conditions: list[dict]) -> list[tuple[dict[str, Any], float]]:
        current = [({}, 1.0)]
        for cond in conditions:
            nxt = []
            for bindings, cur_deg in current:
                for b, d in self._match_condition(cond, bindings):
                    nxt.append((b, min(cur_deg, d)))
            current = nxt
            if not current:
                break
        return current

    def run(self, max_iter: int = 100) -> list[str]:
        fired_rules = []
        for _ in range(max_iter):
            changed = False
            for rule in self.rules:
                for bindings, _ in self._satisfy_all(rule["conditions"]):
                    fired_key = f"{rule['name']}|{json.dumps(bindings, sort_keys=True)}"
                    if fired_key in self._fired:
                        continue
                    self._fired.add(fired_key)
                    fired_rules.append(rule["name"])
                    for action in rule["actions"]:
                        afact = action["fact"]
                        args = [
                            str(bindings[a]) if a.startswith("?") and a in bindings else a
                            for a in afact["args"]
                        ]
                        deg = _eval_degree(afact["deg"], bindings)
                        key = (afact["pred"], *args)
                        if action["type"] == "add":
                            old = self.facts.get(key, -1.0)
                            if deg > old:
                                self.facts[key] = deg
                                changed = True
                        elif action["type"] == "remove":
                            if key in self.facts:
                                del self.facts[key]
                                changed = True
            if not changed:
                break
        return fired_rules
Enter fullscreen mode Exit fullscreen mode

That is the whole thing. No dependencies, no frameworks. The _match_condition method does unification-style pattern matching against the fact store. The _satisfy_all method chains multiple conditions together, threading variable bindings through. And run loops until fixpoint.

Notice the _fired set. Each (rule, bindings) pair fires at most once. Without this, a rule like "if mammal then warm-blooded" would fire over and over on the same animal, producing infinite loops. The history set is what makes the loop terminate.

Also notice how degrees propagate. When _satisfy_all combines multiple conditions, it takes the minimum degree -- the weakest link principle. Then the rule's action can further attenuate that degree through its degree expression. By the time a fact has been derived through three layers of rules, its degree has been multiplied down from the original inputs. Confident inputs produce confident conclusions. Shaky inputs produce tentative ones.

The widget below visualizes this process step by step. You can see each iteration of the loop, which rules fire, which facts are added, and how degrees propagate through the chain.

The Animal Classifier

Let us put it all together with a concrete example: an animal classifier. We define 10 rules in three layers:

Layer 0 -- Traits. The raw observations: has-hair, has-feathers, eats-meat, has-claws, has-hooves, has-stripes, cannot-fly, has-long-neck, is-aquatic. These are the facts you assert.

Layer 1 -- Classes. Intermediate categories derived from traits: is-mammal (from has-hair), is-bird (from has-feathers), is-carnivore (from eats-meat + has-claws), is-ungulate (from is-mammal + has-hooves).

Layer 2 -- Species. The final identifications: zebra, penguin, eagle, tiger, giraffe, dolphin.

Here is the complete 10-rule knowledge base in Python:

engine = FuzzyEngine()

# --- Layer 1: Base classification (priority 60) ---
engine.add_rule("mammal-rule",
    conditions=[{"pred": "has-hair", "args": ["?x"], "degVar": "?d"}],
    actions=[{"type": "add", "fact": {"pred": "is-mammal", "args": ["?x"],
              "deg": ["*", 0.95, "?d"]}}],
    priority=60)

engine.add_rule("bird-rule",
    conditions=[{"pred": "has-feathers", "args": ["?x"], "degVar": "?d"}],
    actions=[{"type": "add", "fact": {"pred": "is-bird", "args": ["?x"],
              "deg": ["*", 0.95, "?d"]}}],
    priority=60)

engine.add_rule("carnivore-rule",
    conditions=[
        {"pred": "eats-meat", "args": ["?x"], "degVar": "?d1"},
        {"pred": "has-claws", "args": ["?x"], "degVar": "?d2"}],
    actions=[{"type": "add", "fact": {"pred": "is-carnivore", "args": ["?x"],
              "deg": ["*", 0.9, ["min", "?d1", "?d2"]]}}],
    priority=60)

# --- Layer 1.5: Intermediate classification (priority 50) ---
engine.add_rule("ungulate-rule",
    conditions=[
        {"pred": "is-mammal", "args": ["?x"], "degVar": "?d1"},
        {"pred": "has-hooves", "args": ["?x"], "degVar": "?d2"}],
    actions=[{"type": "add", "fact": {"pred": "is-ungulate", "args": ["?x"],
              "deg": ["*", 0.9, ["min", "?d1", "?d2"]]}}],
    priority=50)

# --- Layer 2: Species identification (priority 40) ---
engine.add_rule("zebra-rule",
    conditions=[
        {"pred": "is-ungulate", "args": ["?x"], "degVar": "?d1"},
        {"pred": "has-stripes", "args": ["?x"], "degVar": "?d2"}],
    actions=[{"type": "add", "fact": {"pred": "species", "args": ["?x", "zebra"],
              "deg": ["*", 0.9, ["min", "?d1", "?d2"]]}}],
    priority=40)

engine.add_rule("penguin-rule",
    conditions=[
        {"pred": "is-bird", "args": ["?x"], "degVar": "?d1"},
        {"pred": "cannot-fly", "args": ["?x"], "degVar": "?d2"}],
    actions=[{"type": "add", "fact": {"pred": "species", "args": ["?x", "penguin"],
              "deg": ["*", 0.9, ["min", "?d1", "?d2"]]}}],
    priority=40)

engine.add_rule("eagle-rule",
    conditions=[
        {"pred": "is-bird", "args": ["?x"], "degVar": "?d1"},
        {"pred": "is-carnivore", "args": ["?x"], "degVar": "?d2"}],
    actions=[{"type": "add", "fact": {"pred": "species", "args": ["?x", "eagle"],
              "deg": ["*", 0.9, ["min", "?d1", "?d2"]]}}],
    priority=40)

engine.add_rule("tiger-rule",
    conditions=[
        {"pred": "is-mammal", "args": ["?x"], "degVar": "?d1"},
        {"pred": "is-carnivore", "args": ["?x"], "degVar": "?d2"},
        {"pred": "has-stripes", "args": ["?x"], "degVar": "?d3"}],
    actions=[{"type": "add", "fact": {"pred": "species", "args": ["?x", "tiger"],
              "deg": ["*", 0.9, ["min", "?d1", "?d2", "?d3"]]}}],
    priority=40)

engine.add_rule("giraffe-rule",
    conditions=[
        {"pred": "is-ungulate", "args": ["?x"], "degVar": "?d1"},
        {"pred": "has-long-neck", "args": ["?x"], "degVar": "?d2"}],
    actions=[{"type": "add", "fact": {"pred": "species", "args": ["?x", "giraffe"],
              "deg": ["*", 0.9, ["min", "?d1", "?d2"]]}}],
    priority=40)

engine.add_rule("dolphin-rule",
    conditions=[
        {"pred": "is-mammal", "args": ["?x"], "degVar": "?d1"},
        {"pred": "is-aquatic", "args": ["?x"], "degVar": "?d2"}],
    actions=[{"type": "add", "fact": {"pred": "species", "args": ["?x", "dolphin"],
              "deg": ["*", 0.9, ["min", "?d1", "?d2"]]}}],
    priority=40)
Enter fullscreen mode Exit fullscreen mode

Let us trace through a zebra classification. We start with three facts:

engine.add_fact("has-hair",    ["mystery"], 0.9)
engine.add_fact("has-hooves",  ["mystery"], 0.85)
engine.add_fact("has-stripes", ["mystery"], 0.95)
engine.run()
Enter fullscreen mode Exit fullscreen mode

Iteration 1 (priority 60): mammal-rule fires. has-hair(mystery, 0.9) matches, so is-mammal(mystery) is added with degree 0.95 * 0.9 = 0.855.

Iteration 2 (priority 50): ungulate-rule fires. It needs is-mammal (now present at 0.855) and has-hooves (0.85). Degree: 0.9 * min(0.855, 0.85) = 0.765.

Iteration 3 (priority 40): zebra-rule fires. It needs is-ungulate (0.765) and has-stripes (0.95). Degree: 0.9 * min(0.765, 0.95) = 0.689.

The engine concludes species(mystery, zebra) with degree 0.689. Not certain, but fairly confident. The degree has been attenuated through three layers of rules, each multiplying by its confidence factor and taking the weakest-link minimum. The final number reflects the accumulated uncertainty of the entire chain.

In the creature builder below, toggle traits on and off to build your own animal. Watch the inference tree grow as the engine chains through rules to identify species.

Scaling with LLMs

There is an elephant in the room, and our 10-rule knowledge base cannot classify it.

This is the fundamental critique of classical AI -- what the field calls the knowledge acquisition bottleneck. Hand-crafted expert systems do not scale. Our little animal classifier handles zebras, penguins, and eagles, but ask it about a pangolin and it shrugs. An armadillo? No idea. A platypus, the edge case that breaks every neat classification? Not a chance.

The GOFAI (Good Old-Fashioned AI) community spent decades running into this wall. Knowledge representation works beautifully in toy domains. It falls apart in the real world, where the number of rules needed to cover edge cases grows faster than any expert team can write them. This is why neural networks won -- they do not need hand-crafted rules. They learn directly from data.

So why are we building a fuzzy inference engine in 2026?

Because something has changed. We have LLMs now.

An LLM is, among other things, a remarkably effective knowledge compiler. It has ingested a significant fraction of human knowledge and can emit it in any structured format you ask for. Including fuzzy inference rules.

Here is the prompt that generated our expanded knowledge base:

Generate fuzzy inference rules for animal classification.

Each rule has: name, conditions (pred/args with ?variables and degVar),
actions (type: "add", fact with pred/args/deg expression).

Degree expressions: ["*", factor, "?d"] for single conditions,
["*", factor, ["min", "?d1", "?d2"]] for multiple conditions.

Priority bands: 60 (base class), 50 (intermediate), 40 (species).

Cover: insects, arachnids, primates, canines, felines, habitat-based
reasoning, behavioral traits, edge cases (pangolin vs armadillo,
crow vs raven, seal vs sea lion). Target: ~100 rules, ~30 species.
Enter fullscreen mode Exit fullscreen mode

Feed that to an LLM, and you get back a structured rule set that covers insects (has-exoskeleton + has-six-legs), arachnids (has-eight-legs + has-exoskeleton), primates (is-mammal + has-opposable-thumbs), habitat-based reasoning (desert, arctic, jungle, savanna), behavioral traits (burrows, climbs trees, hunts at night), and the disambiguation rules that handle the hard cases.

The 10-rule knowledge base becomes 25. Then 100. Then 500.

At 25 rules, the system adds reptiles, amphibians, and a few more species -- snakes, crocodiles, whales, bats. At 100 rules, it handles insects, arachnids, primates, canines, felines, and about 30 species total. It can tell a pangolin from an armadillo (pangolins have scales but are mammals; armadillos have bony armor). At 500 rules, it covers the long tail: axolotls, platypuses, narwhals, cassowaries, okapis. Over 100 species identifiable from trait combinations.

The structure of the rules stays the same at every scale. Same format, same engine, same degree expressions. The only thing that changes is the number of rules. The engine does not care whether a human or an LLM wrote them.

This reframes fuzzy inference. It is not a relic of 1980s AI. It is an interpretable reasoning layer that LLMs can populate. The LLM handles the knowledge acquisition problem -- the part that killed classical expert systems -- and the fuzzy engine handles the reasoning. Each does what it is good at.

Use the slider below to scale the rule count from 10 to 500. Watch the inference tree grow denser as the system gains the ability to handle edge cases and disambiguation. At 10 rules, toggling "has scales" does nothing interesting. At 500 rules, it opens up an entire branch of reptilian classification.

Reflection

We have built, from scratch, a fuzzy inference engine that fits in 100 lines of Python. We have seen it classify animals through forward chaining, propagating degrees of belief through layers of rules. And we have seen how LLMs dissolve the knowledge acquisition bottleneck that historically made these systems impractical.

Three properties make this combination worth paying attention to.

Interpretability. Every conclusion the engine reaches can be traced back through the exact chain of rules that produced it. When the engine says species(mystery, zebra) at degree 0.689, you can follow the trail: zebra-rule fired because is-ungulate(mystery, 0.765) and has-stripes(mystery, 0.95), and is-ungulate came from ungulate-rule firing on is-mammal(mystery, 0.855) and has-hooves(mystery, 0.85), and is-mammal came from mammal-rule firing on has-hair(mystery, 0.9). Every step is visible, every degree is justified. Try doing that with a neural network's activations.

Debuggability. When the system gets something wrong, you can point to the specific rule that caused the error and fix it. If the engine incorrectly classifies a whale as a fish, you find the offending rule, adjust its conditions or degree expression, and re-run. No retraining, no hyperparameter tuning, no wondering whether your fix broke something else on the other side of the model. The fix is local and its effects are predictable.

The neural-symbolic bridge. This is perhaps the most interesting angle. LLMs are excellent at generating structured knowledge but poor at consistent, traceable reasoning. Fuzzy inference engines are excellent at consistent, traceable reasoning but historically required a human to supply the knowledge. The combination -- LLMs as knowledge compilers, fuzzy systems as interpretable executors -- gives you both.

The engine does not care where its rules come from. A domain expert can write them by hand for a safety-critical application where every rule must be reviewed. An LLM can generate hundreds for a prototype. A hybrid workflow can start with LLM-generated rules and have a human prune, correct, and extend them. The rules are data, plain and inspectable, in a format that both humans and machines can read.

Fuzzy logic is sixty years old. Forward chaining goes back to the production systems of the 1970s. These are not new ideas. But the ability to populate a knowledge base at scale, with an LLM, in seconds -- that is new. And it changes the cost-benefit calculation entirely.

The full fuzzy-infer library implements everything shown here, with both a Python package and a TypeScript engine. The source code for this interactive post is in the same repository.

/* ==========================================================================
Fuzzy-Infer Explorable — Widget Styles
Scoped to .fuzzy-* classes to avoid collisions with host page.
Designed for LIGHT backgrounds (ananke theme).
========================================================================== */

/* --- Controls container --- */

.fuzzy-controls {
padding: 0.75rem 0;
font-family: system-ui, -apple-system, sans-serif;
font-size: 14px;
color: #1e293b;
}

/* --- Trait toggle list --- */

.fuzzy-toggles {
display: flex;
flex-direction: column;
gap: 4px;
max-height: 300px;
overflow-y: auto;
}

.fuzzy-toggle {
display: flex;
align-items: center;
gap: 8px;
padding: 4px 6px;
border-radius: 4px;
transition: background 0.15s;
}

.fuzzy-toggle:hover {
background: rgba(0, 0, 0, 0.04);
}

.fuzzy-toggle.active {
background: rgba(22, 163, 74, 0.08);
}

.fuzzy-toggle-check {
accent-color: #16a34a;
width: 16px;
height: 16px;
cursor: pointer;
flex-shrink: 0;
}

.fuzzy-toggle-label {
flex: 1;
cursor: pointer;
user-select: none;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: #334155;
}

.fuzzy-toggle.active .fuzzy-toggle-label {
color: #14532d;
font-weight: 500;
}

.fuzzy-toggle-deg {
font-variant-numeric: tabular-nums;
color: #64748b;
min-width: 3ch;
text-align: right;
flex-shrink: 0;
}

/* --- Degree slider --- */

.fuzzy-slider-wrap {
display: flex;
align-items: center;
gap: 10px;
padding: 8px 6px;
}

.fuzzy-slider-label {
font-size: 13px;
color: #475569;
white-space: nowrap;
min-width: 100px;
}

.fuzzy-slider {
flex: 1;
height: 4px;
accent-color: #16a34a;
cursor: pointer;
}

/* --- Rule tier slider --- */

.fuzzy-tier-wrap {
display: flex;
align-items: center;
gap: 10px;
padding: 10px 6px;
border-bottom: 1px solid rgba(0, 0, 0, 0.08);
margin-bottom: 8px;
}

.fuzzy-tier-label {
font-size: 13px;
color: #92400e;
font-weight: 500;
white-space: nowrap;
min-width: 140px;
}

.fuzzy-tier-slider {
flex: 1;
height: 4px;
accent-color: #d97706;
cursor: pointer;
}

/* --- Step controls --- */

.fuzzy-step-controls {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 0;
flex-wrap: wrap;
}

.fuzzy-btn {
padding: 6px 14px;
border: 1px solid #cbd5e1;
border-radius: 6px;
background: #f8fafc;
color: #334155;
font-size: 13px;
font-family: system-ui, -apple-system, sans-serif;
cursor: pointer;
transition: background 0.15s, border-color 0.15s;
user-select: none;
}

.fuzzy-btn:hover {
background: #f1f5f9;
border-color: #94a3b8;
}

.fuzzy-btn:active {
background: #e2e8f0;
}

.fuzzy-btn-primary {
background: #dcfce7;
border-color: #86efac;
color: #14532d;
}

.fuzzy-btn-primary:hover {
background: #bbf7d0;
border-color: #4ade80;
}

.fuzzy-btn-primary:active {
background: #a7f3d0;
}

.fuzzy-iter-label {
font-size: 13px;
color: #64748b;
margin-left: 8px;
font-variant-numeric: tabular-nums;
}

/* --- Creature builder layout --- */

.fuzzy-creature-wrap {
display: flex;
gap: 16px;
min-height: 420px;
}

.fuzzy-creature-controls {
flex: 0 0 220px;
overflow-y: auto;
max-height: 500px;
}

.fuzzy-creature-canvas {
flex: 1;
min-width: 0;
min-height: 400px;
position: relative;
}

/* --- Fact sidebar (chain demo) --- */

.fuzzy-fact-sidebar {
flex: 0 0 200px;
font-family: system-ui, -apple-system, sans-serif;
font-size: 12px;
color: #475569;
padding: 8px;
background: #f8fafc;
border-radius: 6px;
border: 1px solid #e2e8f0;
overflow-y: auto;
max-height: 320px;
display: flex;
flex-direction: column;
gap: 2px;
}

.fuzzy-fact-sidebar strong {
display: block;
margin-bottom: 6px;
color: #1e293b;
font-size: 13px;
}

/* --- Mobile breakpoint: stack creature layout vertically --- */

@media (max-width: 640px) {
.fuzzy-creature-wrap {
flex-direction: column;
}

.fuzzy-creature-controls {
flex: none;
max-height: none;
overflow-y: visible;
}

.fuzzy-creature-canvas {
min-height: 300px;
}

.fuzzy-fact-sidebar {
flex: none;
max-height: 200px;
}
}

"use strict";(()=>{function A(g,r,a){return g+(r-g)a}function ye(g){return 1-(1-g)(1-g)}function ge(g,r,a,d,i,s,t){let n=Math.round(A(g,d,t)),l=Math.round(A(r,i,t)),x=Math.round(A(a,s,t));returnrgb(${n},${l},${x})}var q=class{constructor(r){this.layout=null;this.pulses=[];this.animFrame=0;this.running=!1;this.nodeAnims=new Map;this.prevNodeIds=new Set;this.tooltip=null;this.panX=0;this.panY=0;this.zoom=1;this.isPanning=!1;this.panStartX=0;this.panStartY=0;this.handleWheel=r=>{r.preventDefault();let a=this.canvas.getBoundingClientRect(),d=r.clientX-a.left,i=r.clientY-a.top,s=r.deltaY<0?1.1:1/1.1,t=Math.max(.3,Math.min(5,this.zoom*s));this.panX=d-(d-this.panX)(t/this.zoom),this.panY=i-(i-this.panY)(t/this.zoom),this.zoom=t,this.running||this.draw()};this.handleMouseDown=r=>{(r.button===1||r.button===0&&!this.hitTest(r.clientX,r.clientY))&&(this.isPanning=!0,this.panStartX=r.clientX-this.panX,this.panStartY=r.clientY-this.panY,this.canvas.style.cursor="grabbing",r.preventDefault())};this.handleMouseUp=r=>{this.isPanning&&(this.isPanning=!1,this.canvas.style.cursor="default")};this.handleMouseMove=r=>{if(this.isPanning){this.panX=r.clientX-this.panStartX,this.panY=r.clientY-this.panStartY,this.running||this.draw();return}let a=this.hitTest(r.clientX,r.clientY);a?(this.showTooltip(a,r.clientX,r.clientY),this.canvas.style.cursor="pointer"):(this.removeTooltip(),this.canvas.style.cursor="grab")};this.handleMouseLeave=()=>{this.removeTooltip(),this.canvas.style.cursor="default"};this.handleClick=r=>{if(!this.onClick)return;let a=this.hitTest(r.clientX,r.clientY);a&&this.onClick(a.id)};this.canvas=r;let a=r.getContext("2d");if(!a)throw new Error("Canvas 2D context unavailable");this.ctx=a,this.resize(),this.setupEvents()}resetCamera(){this.panX=0,this.panY=0,this.zoom=1}clientToWorld(r,a){let d=this.canvas.getBoundingClientRect(),i=r-d.left,s=a-d.top;return{x:(i-this.panX)/this.zoom,y:(s-this.panY)/this.zoom}}setLayout(r){let a=new Set(r.nodes.map(d=>d.id));for(let d of r.nodes){let i=this.nodeAnims.get(d.id);if(i)i.targetOpacity=1;else{let n=r.nodes.filter(l=>l.layer===d.layer).indexOf(d).05;this.nodeAnims.set(d.id,{opacity:Math.max(0,-n),targetOpacity:1})}}for(let d of this.prevNodeIds)if(!a.has(d)){let i=this.nodeAnims.get(d);i&&(i.targetOpacity=0)}this.prevNodeIds=a,this.layout=r,this.canvas.style.height=${r.height}px}resize(){let r=window.devicePixelRatio||1,a=this.canvas.getBoundingClientRect();this.canvas.width=a.width*r,this.canvas.height=a.height*r,this.ctx.setTransform(r,0,0,r,0,0)}start(){if(this.running)return;this.running=!0;let r=()=>{this.running&&(this.draw(),this.animFrame=requestAnimationFrame(r))};this.animFrame=requestAnimationFrame(r)}stop(){this.running=!1,this.animFrame&&(cancelAnimationFrame(this.animFrame),this.animFrame=0)}firePulse(r,a){this.pulses.push({fromId:r,toId:a,startTime:performance.now(),duration:300})}hitTest(r,a){if(!this.layout)return null;let{x:d,y:i}=this.clientToWorld(r,a);for(let s=this.layout.nodes.length-1;s>=0;s--){let t=this.layout.nodes[s],n=be(t)+6,l=d-t.x,x=i-t.y;if(l*l+x*x<=n*n)return t}return null}destroy(){this.stop(),this.removeTooltip(),this.canvas.removeEventListener("mousemove",this.handleMouseMove),this.canvas.removeEventListener("mouseleave",this.handleMouseLeave),this.canvas.removeEventListener("click",this.handleClick),this.canvas.removeEventListener("wheel",this.handleWheel),this.canvas.removeEventListener("mousedown",this.handleMouseDown),this.canvas.removeEventListener("mouseup",this.handleMouseUp)}draw(){let r=this.layout;if(!r)return;let a=this.canvas.getBoundingClientRect(),d=a.width,i=a.height,s=this.ctx;s.save(),s.clearRect(0,0,d,i),this.updateAnimations(),s.translate(this.panX,this.panY),s.scale(this.zoom,this.zoom);for(let n of r.edges)this.drawEdge(n,r);let t=performance.now();this.pulses=this.pulses.filter(n=>t-n.startTime<n.duration);for(let n of this.pulses)this.drawPulse(n,r,t);for(let n of r.nodes)this.drawNode(n);for(let[n,l]of this.nodeAnims)l.targetOpacity===0&&l.opacity<=.01&&this.nodeAnims.delete(n);s.restore()}updateAnimations(){let r=1-Math.pow(.001,.032);for(let a of this.nodeAnims.values())a.opacity=A(a.opacity,a.targetOpacity,r),a.opacity=Math.max(0,Math.min(1,a.opacity))}getNodeOpacity(r){return this.nodeAnims.get(r)?.opacity??1}drawEdge(r,a){let d=a.nodes.find(x=>x.id===r.from),i=a.nodes.find(x=>x.id===r.to);if(!d||!i)return;let s=this.ctx,t=this.getNodeOpacity(d.id),n=this.getNodeOpacity(i.id),l=Math.min(t,n);s.save(),s.globalAlpha=l.6,s.beginPath(),s.moveTo(d.x,d.y),s.lineTo(i.x,i.y),r.active?(s.strokeStyle="#16a34a",s.lineWidth=2,s.setLineDash([])):(s.strokeStyle="#d1d5db",s.lineWidth=1,s.setLineDash([4,4])),s.stroke(),s.setLineDash([]),s.restore()}drawPulse(r,a,d){let i=a.nodes.find(h=>h.id===r.fromId),s=a.nodes.find(h=>h.id===r.toId);if(!i||!s)return;let t=d-r.startTime,n=ye(Math.min(1,t/r.duration)),l=A(i.x,s.x,n),x=A(i.y,s.y,n),m=n<.8?1:(1-n)/.2,u=this.ctx;u.save(),u.globalAlpha=m*.9,u.beginPath(),u.arc(l,x,4,0,Math.PI*2),u.fillStyle="#4ade80",u.fill(),u.shadowColor="#4ade80",u.shadowBlur=8,u.fill(),u.restore()}drawNode(r){let a=this.getNodeOpacity(r.id);if(a<.01)return;let d=this.ctx;switch(d.save(),d.globalAlpha=a,r.type){case"fact":this.drawFactNode(r);break;case"rule":this.drawRuleNode(r);break;case"result":this.drawResultNode(r);break}d.restore()}drawFactNode(r){let a=this.ctx,d=28,i=r.active?ge(229,231,235,187,247,208,r.deg):"#e5e7eb";this.roundedRect(r.x-d,r.y-d*.7,d*2,d*1.4,6),a.fillStyle=i,a.fill(),a.strokeStyle=r.active?"#16a34a":"#d1d5db",a.lineWidth=r.active?2:1,this.roundedRect(r.x-d,r.y-d*.7,d*2,d*1.4,6),a.stroke(),a.fillStyle=r.active?"#14532d":"#6b7280",a.font="10px system-ui, sans-serif",a.textAlign="center",a.textBaseline="middle";let s=G(r.label,10);a.fillText(s,r.x,r.y-4),r.active&&(a.fillStyle="#15803d",a.font="8px system-ui, sans-serif",a.fillText(r.deg.toFixed(2),r.x,r.y+8))}drawRuleNode(r){let a=this.ctx,d=18;a.beginPath(),a.moveTo(r.x,r.y-d),a.lineTo(r.x+d,r.y),a.lineTo(r.x,r.y+d),a.lineTo(r.x-d,r.y),a.closePath(),a.fillStyle=r.active?"#fef3c7":"#f3f4f6",a.fill(),a.strokeStyle=r.active?"#d97706":"#d1d5db",a.lineWidth=r.active?2:1,a.beginPath(),a.moveTo(r.x,r.y-d),a.lineTo(r.x+d,r.y),a.lineTo(r.x,r.y+d),a.lineTo(r.x-d,r.y),a.closePath(),a.stroke(),a.fillStyle=r.active?"#92400e":"#6b7280",a.font="8px system-ui, sans-serif",a.textAlign="center",a.textBaseline="middle";let i=G(r.label,12);a.fillText(i,r.x,r.y)}drawResultNode(r){let a=this.ctx,d=34;this.roundedRect(r.x-d,r.y-d*.6,d*2,d*1.2,8),a.fillStyle=r.active?ge(219,234,254,191,219,254,r.deg):"#f3f4f6",a.fill();let i=r.active?1+r.deg*3:1;a.strokeStyle=r.active?"#2563eb":"#d1d5db",a.lineWidth=i,this.roundedRect(r.x-d,r.y-d*.6,d*2,d*1.2,8),a.stroke(),a.fillStyle=r.active?"#1e3a5f":"#6b7280",a.font="bold 11px system-ui, sans-serif",a.textAlign="center",a.textBaseline="middle";let s=G(r.label,12);a.fillText(s,r.x,r.y-3),r.active&&(a.fillStyle="#1d4ed8",a.font="9px system-ui, sans-serif",a.fillText(r.deg.toFixed(2),r.x,r.y+10))}roundedRect(r,a,d,i,s){let t=this.ctx;t.beginPath(),t.moveTo(r+s,a),t.lineTo(r+d-s,a),t.quadraticCurveTo(r+d,a,r+d,a+s),t.lineTo(r+d,a+i-s),t.quadraticCurveTo(r+d,a+i,r+d-s,a+i),t.lineTo(r+s,a+i),t.quadraticCurveTo(r,a+i,r,a+i-s),t.lineTo(r,a+s),t.quadraticCurveTo(r,a,r+s,a),t.closePath()}setupEvents(){this.canvas.addEventListener("mousemove",this.handleMouseMove),this.canvas.addEventListener("mouseleave",this.handleMouseLeave),this.canvas.addEventListener("click",this.handleClick),this.canvas.addEventListener("wheel",this.handleWheel,{passive:!1}),this.canvas.addEventListener("mousedown",this.handleMouseDown),this.canvas.addEventListener("mouseup",this.handleMouseUp)}showTooltip(r,a,d){this.tooltip||(this.tooltip=document.createElement("div"),this.tooltip.style.position="absolute",this.tooltip.style.pointerEvents="none",this.tooltip.style.zIndex="10000",this.tooltip.style.background="rgba(0,0,0,0.85)",this.tooltip.style.color="#fff",this.tooltip.style.padding="6px 10px",this.tooltip.style.borderRadius="4px",this.tooltip.style.fontSize="12px",this.tooltip.style.fontFamily="system-ui, sans-serif",this.tooltip.style.maxWidth="250px",this.tooltip.style.whiteSpace="pre-wrap",document.body.appendChild(this.tooltip));let i;switch(r.type){case"fact":i=Trait: ${r.label}
Degree: ${r.deg.toFixed(2)}
Status: ${r.active?"active":"inactive"}
;break;case"rule":i=Rule: ${r.label}
Status: ${r.active?"fired":"idle"}
;break;case"result":i=Result: ${r.label}
Degree: ${r.deg.toFixed(2)}
Status: ${r.active?"inferred":"not inferred"}
;break}this.tooltip.textContent=i;let s=12;this.tooltip.style.left=${a+s}px,this.tooltip.style.top=${d+s}px}removeTooltip(){this.tooltip&&(this.tooltip.remove(),this.tooltip=null)}};function be(g){switch(g.type){case"fact":return 28;case"rule":return 18;case"result":return 34;default:return 28}}function G(g,r){return g.length>r?g.slice(0,r-1)+"\u2026":g}function ne(g){let r=document.createElement("canvas");r.style.width="100%",r.style.height="200px",r.style.display="block",g.appendChild(r);let a=document.createElement("div");a.className="fuzzy-slider-wrap";let d=document.createElement("span");d.className="fuzzy-slider-label",d.textContent="Degree: 0.80",a.appendChild(d);let i=document.createElement("input");i.type="range",i.className="fuzzy-slider",i.min="0",i.max="1",i.step="0.01",i.value="0.80",a.appendChild(i),g.appendChild(a);let s=new q(r),t=.8;function n(){let m=r.getBoundingClientRect().width||400,u=200,h=m/2,b=u/2;return{nodes:[{id:"fact:has-hair",x:h,y:b,layer:0,type:"fact",label:"has-hair(rex)",deg:t,active:t>0}],edges:[],width:m,height:u}}function l(){s.resize(),s.setLayout(n()),s.draw()}i.addEventListener("input",()=>{let m=parseFloat(i.value);isFinite(m)&&(t=m,d.textContent=Degree: ${m.toFixed(2)},l())}),l();let x=()=>l();window.addEventListener("resize",x)}function oe(g,r){return${g}|${r.join(",")}}var I=class{constructor(){this.facts=new Map;this.rules=[];this.fired=new Set}addFact(r){let a=oe(r.pred,r.args),d=this.facts.get(a);d&&d.deg>=r.deg||this.facts.set(a,{...r})}getFacts(){return this.facts}addRule(r){this.rules.push({...r}),this.rules.sort((a,d)=>d.priority-a.priority)}getRules(){return this.rules}clear(){this.facts.clear(),this.rules=[],this.fired.clear()}clearFacts(){this.facts.clear(),this.fired.clear()}matchCondition(r,a){let d=[];for(let i of this.facts.values()){if(i.pred!==r.pred||i.args.length!==r.args.length)continue;let s={...a},t=!0;for(let n=0;n<r.args.length;n++){let l=r.args[n],x=i.args[n];if(l.startsWith("?"))if(l in s){if(s[l]!==x){t=!1;break}}else s[l]=x;else if(l!==x){t=!1;break}}t&&(r.degVar&&(s[r.degVar]=i.deg),!(r.degConstraint&&!ve(r.degConstraint,i.deg))&&d.push({bindings:s,deg:i.deg}))}return d}satisfyConditions(r){let a=[{bindings:{},deg:1}];for(let d of r){let i=[];for(let s of a)for(let t of this.matchCondition(d,s.bindings))i.push({bindings:t.bindings,deg:Math.min(s.deg,t.deg)});if(a=i,a.length===0)break}return a}resolveArg(r,a){return r.startsWith("?")&&r in a?String(a[r]):r}applyAction(r,a){let d=r.fact.args.map(n=>this.resolveArg(n,a)),i=oe(r.fact.pred,d);if(r.type==="remove")return this.facts.delete(i);let s=ke(r.fact.deg,a),t=this.facts.get(i);return t&&t.deg>=s?!1:(this.facts.set(i,{pred:r.fact.pred,args:d,deg:s}),!0)}runOneIteration(){let r=!1,a=[];for(let d of this.rules){let i=this.satisfyConditions(d.conditions);for(let s of i){let t=${d.name}|${JSON.stringify(s.bindings)};if(!this.fired.has(t)){this.fired.add(t),a.push(d.name);for(let n of d.actions)this.applyAction(n,s.bindings)&&(r=!0)}}}return{changed:r,firedRules:a}}run(r=100){let a=[],d=0;for(let i=0;i<r;i++){d++;let{changed:s,firedRules:t}=this.runOneIteration();if(a.push(...t),!s)break}return{facts:this.facts,firedRules:a,iterations:d}}resetFired(){this.fired.clear()}};function ve(g,r){let[a,,d]=g;switch(a){case">":return r>d;case"<":return r<d;case">=":return r>=d;case"<=":return r<=d;case"==":return r===d;case"!=":return r!==d;default:return!0}}var we=g=>Math.max(0,Math.min(1,g));function le(g,r){if(typeof g=="number")return g;if(typeof g=="string")return g.startsWith("?")&&g in r?Number(r[g]):Number(g);let[a,...d]=g,i=d.map(s=>le(s,r));switch(a){case"":return i.reduce((s,t)=>s*t,1);case"+":return i.reduce((s,t)=>s+t,0);case"-":return i.reduce((s,t)=>s-t);case"/":return i.reduce((s,t)=>s/t);case"min":return Math.min(...i);case"max":return Math.max(...i);default:return i[0]??0}}function ke(g,r){return we(le(g,r))}function Q(g){return g==="species"}function ee(g){let r=new Set;for(let s of g)for(let t of s.actions)t.type==="add"&&!Q(t.fact.pred)&&r.add(t.fact.pred);let a=new Set;for(let s of g)for(let t of s.conditions)a.add(t.pred);let d=new Set;for(let s of a)r.has(s)||d.add(s);return{traits:d,classifications:r}}function Ce(g){let r=new Map;for(let a of g){let d=a.pred,i=r.get(d)??0;a.deg>i&&r.set(d,a.deg)}return r}function _(g,r,a,d){if(g===0)return[];if(g===1)return[{x:a/2,y:r}];let s=(a-2*d)/(g-1);return Array.from({length:g},(t,n)=>({x:d+n*s,y:r}))}function U(g,r,a,d){let i=[],s=[],{traits:t,classifications:n}=ee(r),l=Ce(g),x=d?.firedRules!==void 0,m=new Set(d?.firedRules??[]),u=x?r.filter(p=>m.has(p.name)):r,h=new Set,b=new Set;for(let p of u)for(let c of p.actions)if(c.type==="add")if(Q(c.fact.pred)){let V=c.fact.args[1];V&&!V.startsWith("?")&&b.add(V)}else n.has(c.fact.pred)&&h.add(c.fact.pred);let C=u.length>0,E=h.size>0,v=b.size>0,T=1;C&&T++,E&&T++,v&&T++;let k=a.05,f=100,R=k*2+T*f,y=0,w=p=>k+p*f+f/2,N=w(y++),P=C?w(y++):0,M=E?w(y++):0,j=v?w(y++):0,F;if(x){let p=new Set;for(let c of u)for(let V of c.conditions)t.has(V.pred)&&p.add(V.pred);F=[...t].filter(c=>l.has(c)||p.has(c)).sort()}else F=[...t].sort();let D=(F.length,N,a,k),ae=new Map;for(let p=0;p<F.length;p++){let c=F[p],V=trait:${c};ae.set(c,V),i.push({id:V,x:D[p].x,y:D[p].y,layer:0,type:"fact",label:c,deg:l.get(c)??0,active:l.has(c)})}let H=[...u].sort((p,c)=>p.name.localeCompare(c.name)),de=(H.length,P,a,k),se=new Map;for(let p=0;p<H.length;p++){let c=H[p],V=rule:${c.name};se.set(c.name,V),i.push({id:V,x:de[p].x,y:de[p].y,layer:1,type:"rule",label:c.name,deg:0,active:m.has(c.name)})}let X=[...h].sort(),ie=(X.length,M,a,k),K=new Map;for(let p=0;p<X.length;p++){let c=X[p],V=class:${c};K.set(c,V);let z=l.get(c)??0;i.push({id:V,x:ie[p].x,y:ie[p].y,layer:2,type:"result",label:c,deg:z,active:z>0})}let J=[...b].sort(),te=(J.length,j,a,k);for(let p=0;p<J.length;p++){let c=J[p],V=species:${c},z=Ee(g,c);i.push({id:V,x:te[p].x,y:te[p].y,layer:3,type:"result",label:c,deg:z,active:z>0})}for(let p of u){let c=se.get(p.name);if(c){for(let V of p.conditions){let z=ae.get(V.pred)??K.get(V.pred);if(z){let L=i.find(Z=>Z.id===z);s.push({from:z,to:c,active:!!(L&&L.active)})}}for(let V of p.actions){if(V.type!=="add")continue;let z=V.fact.pred;if(h.has(z)){let L=K.get(z);L&&s.push({from:c,to:L,active:m.has(p.name)})}else if(Q(z)){let L=V.fact.args[1];if(L&&!L.startsWith("?")&&b.has(L)){let Z=species:${L};s.push({from:c,to:Z,active:m.has(p.name)})}}}}}return{nodes:i,edges:s,width:a,height:R}}function Ee(g,r){let a=0;for(let d of g)d.pred==="species"&&d.args.includes(r)&&d.deg>a&&(a=d.deg);return a}var pe={name:"mammal-rule",conditions:[{pred:"has-hair",args:["?x"],degVar:"?d",degConstraint:[">","?d",0]}],actions:[{type:"add",fact:{pred:"is-mammal",args:["?x"],deg:["",.95,"?d"]}}],priority:60};function ce(g){let r=!0,a=.8,d=document.createElement("div");d.className="fuzzy-controls";let i=document.createElement("div");i.className="fuzzy-toggle";let s=document.createElement("input");s.type="checkbox",s.checked=r,s.className="fuzzy-toggle-check",i.appendChild(s);let t=document.createElement("span");t.className="fuzzy-toggle-label",t.textContent="has-hair(rex)",i.appendChild(t);let n=document.createElement("span");n.className="fuzzy-toggle-deg",n.textContent=a.toFixed(2),i.appendChild(n),d.appendChild(i);let l=document.createElement("div");l.className="fuzzy-slider-wrap";let x=document.createElement("span");x.className="fuzzy-slider-label",x.textContent=Degree: ${a.toFixed(2)},l.appendChild(x);let m=document.createElement("input");m.type="range",m.className="fuzzy-slider",m.min="0",m.max="1",m.step="0.01",m.value=String(a),l.appendChild(m),d.appendChild(l),g.appendChild(d);let u=document.createElement("canvas");u.style.width="100%",u.style.height="280px",u.style.display="block",g.appendChild(u);let h=new q(u);function b(){let C=new I;r&&C.addFact({pred:"has-hair",args:["rex"],deg:a}),C.addRule(pe);let E=C.run(),v=[];for(let y of E.facts.values())v.push(y);let k=u.getBoundingClientRect().width||400,f=U(v,[pe],k),R=new Set(E.firedRules);for(let y of f.nodes)y.type==="rule"&&(y.active=R.has(y.label));for(let y of f.edges){let w=f.nodes.find(P=>P.id===y.from),N=f.nodes.find(P=>P.id===y.to);y.active=!!(w?.active&&N?.active)}h.resize(),h.setLayout(f),h.draw()}s.addEventListener("change",()=>{r=s.checked,n.textContent=r?a.toFixed(2):"\u2014",b()}),m.addEventListener("input",()=>{let C=parseFloat(m.value);isFinite(C)&&(a=C,x.textContent=Degree: ${C.toFixed(2)},n.textContent=r?C.toFixed(2):"\u2014",b())}),b(),window.addEventListener("resize",()=>b())}var ue=[{name:"mammal-rule",conditions:[{pred:"has-hair",args:["?x"],degVar:"?d"}],actions:[{type:"add",fact:{pred:"is-mammal",args:["?x"],deg:["",.95,"?d"]}}],priority:60},{name:"carnivore-rule",conditions:[{pred:"eats-meat",args:["?x"],degVar:"?d1"},{pred:"has-claws",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"is-carnivore",args:["?x"],deg:["",.9,["min","?d1","?d2"]]}}],priority:60},{name:"tiger-rule",conditions:[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-carnivore",args:["?x"],degVar:"?d2"},{pred:"has-stripes",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"species",args:["?x","tiger"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:40}],Re=[{pred:"has-hair",args:["rex"],deg:.9},{pred:"eats-meat",args:["rex"],deg:.8},{pred:"has-claws",args:["rex"],deg:.85},{pred:"has-stripes",args:["rex"],deg:.7}];function xe(g){let r=new I,a=0,d=null;function i(){r=new I;for(let f of Re)r.addFact(f);for(let f of ue)r.addRule(f);a=0}i();let s=document.createElement("div");s.className="fuzzy-step-controls";let t=document.createElement("button");t.className="fuzzy-btn",t.textContent="Reset",s.appendChild(t);let n=document.createElement("button");n.className="fuzzy-btn",n.textContent="Step",s.appendChild(n);let l=document.createElement("button");l.className="fuzzy-btn fuzzy-btn-primary",l.textContent="Play",s.appendChild(l);let x=document.createElement("span");x.className="fuzzy-iter-label",x.textContent="Iteration: 0",s.appendChild(x),g.appendChild(s);let m=document.createElement("div");m.style.display="flex",m.style.gap="12px";let u=document.createElement("canvas");u.style.flex="1",u.style.minWidth="0",u.style.height="320px",u.style.display="block",m.appendChild(u);let h=document.createElement("div");h.className="fuzzy-fact-sidebar",m.appendChild(h),g.appendChild(m);let b=new q(u);function C(){let f=[];for(let R of r.getFacts().values())f.push(R);return f}function E(f){for(;h.firstChild;)h.removeChild(h.firstChild);let R=document.createElement("strong");R.textContent="Knowledge Base",h.appendChild(R);for(let y of f){let w=document.createElement("div");w.textContent=${y.pred}(${y.args.join(", ")}) [${y.deg.toFixed(2)}],h.appendChild(w)}}function v(f){let R=C(),w=u.getBoundingClientRect().width||400,N=U(R,ue,w),P=new Set(f??[]);for(let M of N.nodes)M.type==="rule"&&(M.active=P.has(M.label));for(let M of N.edges){let j=N.nodes.find(D=>D.id===M.from),F=N.nodes.find(D=>D.id===M.to);j&&F&&(M.active=j.active||j.type!=="rule"&&F.active)}b.resize(),b.setLayout(N),b.draw(),E(R),x.textContent=Iteration: ${a}}function T(){let{changed:f,firedRules:R}=r.runOneIteration();a++,v(R),f||k()}function k(){d!==null&&(clearInterval(d),d=null,l.textContent="Play")}t.addEventListener("click",()=>{k(),i(),v()}),n.addEventListener("click",()=>{k(),T()}),l.addEventListener("click",()=>{d!==null?k():(l.textContent="Pause",d=setInterval(T,800))}),v(),window.addEventListener("resize",()=>v())}var O=[{count:10,label:"10 (hand-crafted)"},{count:25,label:"25 (expanded)"},{count:100,label:"100 (LLM-curated)"},{count:500,label:"500 (LLM-generated)"}],B=class{constructor(r){this.selectedIndex=-1;this.currentTier=0;this.config=r,this.traits=r.traits.map(a=>({...a})),this.render()}getTraits(){return this.traits.map(r=>({...r}))}setTraits(r){this.traits=r.map(a=>({...a})),this.selectedIndex=-1,this.render()}render(){let r=this.config.container;me(r);let a=S("div","fuzzy-controls");this.config.showRuleSlider&&a.appendChild(this.buildTierSlider()),a.appendChild(this.buildToggles()),this.selectedIndex>=0&&this.traits[this.selectedIndex]?.active&&a.appendChild(this.buildDegreeSlider()),this.config.showStepControls&&a.appendChild(this.buildStepControls()),r.appendChild(a)}destroy(){me(this.config.container)}buildToggles(){let r=S("div","fuzzy-toggles");for(let a=0;a<this.traits.length;a++){let d=this.traits[a],i=S("div",d.active?"fuzzy-toggle active":"fuzzy-toggle"),s=document.createElement("input");s.type="checkbox",s.checked=d.active,s.className="fuzzy-toggle-check",s.addEventListener("change",()=>{this.traits[a].active=s.checked,s.checked&&this.selectedIndex!==a?this.selectedIndex=a:!s.checked&&this.selectedIndex===a&&(this.selectedIndex=-1),this.config.onChange(this.getTraits()),this.render()}),i.appendChild(s);let t=S("span","fuzzy-toggle-label");t.textContent=d.label,t.addEventListener("click",()=>{d.active&&(this.selectedIndex=this.selectedIndex===a?-1:a,this.render())}),i.appendChild(t);let n=S("span","fuzzy-toggle-deg");n.textContent=d.active?d.deg.toFixed(2):"\u2014",i.appendChild(n),r.appendChild(i)}return r}buildDegreeSlider(){let r=this.traits[this.selectedIndex],a=S("div","fuzzy-slider-wrap"),d=S("span","fuzzy-slider-label");d.textContent=${r.label}: ${r.deg.toFixed(2)},a.appendChild(d);let i=document.createElement("input");return i.type="range",i.className="fuzzy-slider",i.min="0",i.max="1",i.step="0.01",i.value=String(r.deg),i.addEventListener("input",()=>{let s=parseFloat(i.value);if(!isFinite(s))return;this.traits[this.selectedIndex].deg=s,d.textContent=${r.label}: ${s.toFixed(2)};let n=this.config.container.querySelectorAll(".fuzzy-toggle-deg")[this.selectedIndex];n&&(n.textContent=s.toFixed(2)),this.config.onChange(this.getTraits())}),a.appendChild(i),a}buildTierSlider(){let r=S("div","fuzzy-tier-wrap"),a=S("span","fuzzy-tier-label");a.textContent=O[this.currentTier].label,r.appendChild(a);let d=document.createElement("input");return d.type="range",d.className="fuzzy-tier-slider",d.min="0",d.max=String(O.length-1),d.step="1",d.value=String(this.currentTier),d.addEventListener("input",()=>{let i=parseInt(d.value,10);i<0||i>=O.length||(this.currentTier=i,a.textContent=O[i].label,this.config.onRuleTierChange?.(i))}),r.appendChild(d),r}buildStepControls(){let r=S("div","fuzzy-step-controls"),a=S("button","fuzzy-btn");a.textContent="Reset",a.addEventListener("click",()=>this.config.onReset?.()),r.appendChild(a);let d=S("button","fuzzy-btn");d.textContent="Step",d.addEventListener("click",()=>this.config.onStep?.()),r.appendChild(d);let i=S("button","fuzzy-btn fuzzy-btn-primary");return i.textContent="Play",i.addEventListener("click",()=>this.config.onPlay?.()),r.appendChild(i),r}};function S(g,r){let a=document.createElement(g);return a.className=r,a}function me(g){for(;g.firstChild;)g.removeChild(g.firstChild)}var $=[{name:"mammal-rule",conditions:[{pred:"has-hair",args:["?x"],degVar:"?d"}],actions:[{type:"add",fact:{pred:"is-mammal",args:["?x"],deg:["",.95,"?d"]}}],priority:60},{name:"bird-rule",conditions:[{pred:"has-feathers",args:["?x"],degVar:"?d"}],actions:[{type:"add",fact:{pred:"is-bird",args:["?x"],deg:["",.95,"?d"]}}],priority:60},{name:"carnivore-rule",conditions:[{pred:"eats-meat",args:["?x"],degVar:"?d1"},{pred:"has-claws",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"is-carnivore",args:["?x"],deg:["",.9,["min","?d1","?d2"]]}}],priority:60},{name:"ungulate-rule",conditions:[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"has-hooves",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"is-ungulate",args:["?x"],deg:["",.9,["min","?d1","?d2"]]}}],priority:50},{name:"zebra-rule",conditions:[{pred:"is-ungulate",args:["?x"],degVar:"?d1"},{pred:"has-stripes",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","zebra"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"penguin-rule",conditions:[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"cannot-fly",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","penguin"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"eagle-rule",conditions:[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"is-carnivore",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","eagle"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"tiger-rule",conditions:[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-carnivore",args:["?x"],degVar:"?d2"},{pred:"has-stripes",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"species",args:["?x","tiger"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:40},{name:"giraffe-rule",conditions:[{pred:"is-ungulate",args:["?x"],degVar:"?d1"},{pred:"has-long-neck",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","giraffe"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"dolphin-rule",conditions:[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","dolphin"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40}];var W=[...$,{name:"warm-blooded-rule",conditions:[{pred:"is-mammal",args:["?x"],degVar:"?d"}],actions:[{type:"add",fact:{pred:"is-warm-blooded",args:["?x"],deg:["",.95,"?d"]}}],priority:60},{name:"cold-blooded-rule",conditions:[{pred:"has-scales",args:["?x"],degVar:"?d"}],actions:[{type:"add",fact:{pred:"is-cold-blooded",args:["?x"],deg:["",.9,"?d"]}}],priority:60},{name:"omnivore-rule",conditions:[{pred:"eats-meat",args:["?x"],degVar:"?d1"},{pred:"eats-plants",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"is-omnivore",args:["?x"],deg:["",.9,["min","?d1","?d2"]]}}],priority:60},{name:"reptile-rule",conditions:[{pred:"has-scales",args:["?x"],degVar:"?d1"},{pred:"is-cold-blooded",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"is-reptile",args:["?x"],deg:["",.9,["min","?d1","?d2"]]}}],priority:50},{name:"amphibian-rule",conditions:[{pred:"lives-in-water",args:["?x"],degVar:"?d1"},{pred:"lives-on-land",args:["?x"],degVar:"?d2"},{pred:"has-moist-skin",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"is-amphibian",args:["?x"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:50},{name:"snake-rule",conditions:[{pred:"is-reptile",args:["?x"],degVar:"?d1"},{pred:"has-no-legs",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","snake"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"crocodile-rule",conditions:[{pred:"is-reptile",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","crocodile"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"whale-rule",conditions:[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"species",args:["?x","whale"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:40},{name:"bat-rule",conditions:[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"can-fly",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","bat"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"owl-rule",conditions:[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"is-nocturnal",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","owl"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"parrot-rule",conditions:[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"can-talk",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","parrot"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"cheetah-rule",conditions:[{pred:"is-carnivore",args:["?x"],degVar:"?d1"},{pred:"is-fast",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","cheetah"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"bear-rule",conditions:[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-omnivore",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","bear"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"frog-rule",conditions:[{pred:"is-amphibian",args:["?x"],degVar:"?d1"},{pred:"can-jump",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","frog"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40}];var Y=[...W,{name:"insect-base-rule",conditions:[{pred:"has-exoskeleton",args:["?x"],degVar:"?d1"},{pred:"has-six-legs",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"is-insect",args:["?x"],deg:["",.9,["min","?d1","?d2"]]}}],priority:60},{name:"arachnid-base-rule",conditions:[{pred:"has-exoskeleton",args:["?x"],degVar:"?d1"},{pred:"has-eight-legs",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"is-arachnid",args:["?x"],deg:["",.9,["min","?d1","?d2"]]}}],priority:60},{name:"herbivore-rule",conditions:[{pred:"eats-plants",args:["?x"],degVar:"?d1"},{pred:"has-hooves",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"is-herbivore",args:["?x"],deg:["",.9,["min","?d1","?d2"]]}}],priority:60},{name:"bird-warm-blooded-rule",conditions:[{pred:"is-bird",args:["?x"],degVar:"?d"}],actions:[{type:"add",fact:{pred:"is-warm-blooded",args:["?x"],deg:["",.95,"?d"]}}],priority:60},{name:"mammal-from-milk-rule",conditions:[{pred:"produces-milk",args:["?x"],degVar:"?d"}],actions:[{type:"add",fact:{pred:"is-mammal",args:["?x"],deg:["",.95,"?d"]}}],priority:60},{name:"scavenger-rule",conditions:[{pred:"eats-meat",args:["?x"],degVar:"?d1"},{pred:"eats-carrion",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"is-scavenger",args:["?x"],deg:["",.9,["min","?d1","?d2"]]}}],priority:60},{name:"primate-rule",conditions:[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"has-opposable-thumbs",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"is-primate",args:["?x"],deg:["",.9,["min","?d1","?d2"]]}}],priority:50},{name:"canine-rule",conditions:[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-carnivore",args:["?x"],degVar:"?d2"},{pred:"has-snout",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"is-canine",args:["?x"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:50},{name:"feline-rule",conditions:[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-carnivore",args:["?x"],degVar:"?d2"},{pred:"has-retractable-claws",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"is-feline",args:["?x"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:50},{name:"raptor-rule",conditions:[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"is-carnivore",args:["?x"],degVar:"?d2"},{pred:"has-talons",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"is-raptor",args:["?x"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:50},{name:"marsupial-rule",conditions:[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"has-pouch",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"is-marsupial",args:["?x"],deg:["",.9,["min","?d1","?d2"]]}}],priority:50},{name:"pinniped-rule",conditions:[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"},{pred:"has-flippers",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"is-pinniped",args:["?x"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:50},{name:"waterfowl-rule",conditions:[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"is-waterfowl",args:["?x"],deg:["",.9,["min","?d1","?d2"]]}}],priority:50},{name:"rodent-rule",conditions:[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"has-incisors",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"is-rodent",args:["?x"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:50},{name:"cetacean-rule",conditions:[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"},{pred:"has-blowhole",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"is-cetacean",args:["?x"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:50},{name:"flightless-bird-rule",conditions:[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"cannot-fly",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"is-flightless-bird",args:["?x"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:50},{name:"desert-dweller-rule",conditions:[{pred:"lives-in-desert",args:["?x"],degVar:"?d1"},{pred:"is-mammal",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"is-desert-mammal",args:["?x"],deg:["",.9,["min","?d1","?d2"]]}}],priority:50},{name:"arctic-dweller-rule",conditions:[{pred:"lives-in-arctic",args:["?x"],degVar:"?d1"},{pred:"is-mammal",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"is-arctic-mammal",args:["?x"],deg:["",.9,["min","?d1","?d2"]]}}],priority:50},{name:"nocturnal-mammal-rule",conditions:[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-nocturnal",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"is-nocturnal-mammal",args:["?x"],deg:["",.9,["min","?d1","?d2"]]}}],priority:50},{name:"turtle-class-rule",conditions:[{pred:"is-reptile",args:["?x"],degVar:"?d1"},{pred:"has-shell",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"is-turtle",args:["?x"],deg:["",.9,["min","?d1","?d2"]]}}],priority:50},{name:"wolf-rule",conditions:[{pred:"is-canine",args:["?x"],degVar:"?d1"},{pred:"hunts-in-packs",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","wolf"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"fox-rule",conditions:[{pred:"is-canine",args:["?x"],degVar:"?d1"},{pred:"is-small",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","fox"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"lion-rule",conditions:[{pred:"is-feline",args:["?x"],degVar:"?d1"},{pred:"has-mane",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","lion"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"leopard-rule",conditions:[{pred:"is-feline",args:["?x"],degVar:"?d1"},{pred:"has-spots",args:["?x"],degVar:"?d2"},{pred:"climbs-trees",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"species",args:["?x","leopard"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:40},{name:"gorilla-rule",conditions:[{pred:"is-primate",args:["?x"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","gorilla"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"chimpanzee-rule",conditions:[{pred:"is-primate",args:["?x"],degVar:"?d1"},{pred:"uses-tools",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","chimpanzee"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"kangaroo-rule",conditions:[{pred:"is-marsupial",args:["?x"],degVar:"?d1"},{pred:"can-jump",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","kangaroo"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"koala-rule",conditions:[{pred:"is-marsupial",args:["?x"],degVar:"?d1"},{pred:"climbs-trees",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","koala"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"seal-rule",conditions:[{pred:"is-pinniped",args:["?x"],degVar:"?d1"},{pred:"is-small",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","seal"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"sea-lion-rule",conditions:[{pred:"is-pinniped",args:["?x"],degVar:"?d1"},{pred:"has-ear-flaps",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","sea-lion"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"orca-rule",conditions:[{pred:"is-cetacean",args:["?x"],degVar:"?d1"},{pred:"has-black-white-pattern",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","orca"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"elephant-rule",conditions:[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"has-trunk",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"species",args:["?x","elephant"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:40},{name:"camel-rule",conditions:[{pred:"is-desert-mammal",args:["?x"],degVar:"?d1"},{pred:"has-humps",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","camel"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"rhinoceros-rule",conditions:[{pred:"is-ungulate",args:["?x"],degVar:"?d1"},{pred:"has-horn",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"species",args:["?x","rhinoceros"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:40},{name:"squirrel-rule",conditions:[{pred:"is-rodent",args:["?x"],degVar:"?d1"},{pred:"climbs-trees",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","squirrel"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"beaver-rule",conditions:[{pred:"is-rodent",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","beaver"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"polar-bear-rule",conditions:[{pred:"is-arctic-mammal",args:["?x"],degVar:"?d1"},{pred:"is-carnivore",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"species",args:["?x","polar-bear"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:40},{name:"horse-rule",conditions:[{pred:"is-ungulate",args:["?x"],degVar:"?d1"},{pred:"has-mane",args:["?x"],degVar:"?d2"},{pred:"is-fast",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"species",args:["?x","horse"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:40},{name:"hippopotamus-rule",conditions:[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"},{pred:"is-herbivore",args:["?x"],degVar:"?d4"}],actions:[{type:"add",fact:{pred:"species",args:["?x","hippopotamus"],deg:["",.9,["min","?d1","?d2","?d3","?d4"]]}}],priority:40},{name:"hawk-rule",conditions:[{pred:"is-raptor",args:["?x"],degVar:"?d1"},{pred:"is-small",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","hawk"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"falcon-rule",conditions:[{pred:"is-raptor",args:["?x"],degVar:"?d1"},{pred:"is-fast",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","falcon"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"crow-rule",conditions:[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"is-scavenger",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"species",args:["?x","crow"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:40},{name:"raven-rule",conditions:[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"is-scavenger",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"species",args:["?x","raven"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:40},{name:"ostrich-rule",conditions:[{pred:"is-flightless-bird",args:["?x"],degVar:"?d1"},{pred:"is-fast",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","ostrich"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"flamingo-rule",conditions:[{pred:"is-waterfowl",args:["?x"],degVar:"?d1"},{pred:"has-long-legs",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","flamingo"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"duck-rule",conditions:[{pred:"is-waterfowl",args:["?x"],degVar:"?d1"},{pred:"has-webbed-feet",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","duck"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"turtle-rule",conditions:[{pred:"is-turtle",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","sea-turtle"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"tortoise-rule",conditions:[{pred:"is-turtle",args:["?x"],degVar:"?d1"},{pred:"lives-on-land",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","tortoise"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"lizard-rule",conditions:[{pred:"is-reptile",args:["?x"],degVar:"?d1"},{pred:"has-legs",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"species",args:["?x","lizard"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:40},{name:"chameleon-rule",conditions:[{pred:"is-reptile",args:["?x"],degVar:"?d1"},{pred:"changes-color",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","chameleon"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"salamander-rule",conditions:[{pred:"is-amphibian",args:["?x"],degVar:"?d1"},{pred:"has-tail",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","salamander"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"toad-rule",conditions:[{pred:"is-amphibian",args:["?x"],degVar:"?d1"},{pred:"has-dry-skin",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","toad"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"butterfly-rule",conditions:[{pred:"is-insect",args:["?x"],degVar:"?d1"},{pred:"has-wings",args:["?x"],degVar:"?d2"},{pred:"has-bright-colors",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"species",args:["?x","butterfly"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:40},{name:"ant-rule",conditions:[{pred:"is-insect",args:["?x"],degVar:"?d1"},{pred:"lives-in-colony",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","ant"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"bee-rule",conditions:[{pred:"is-insect",args:["?x"],degVar:"?d1"},{pred:"produces-honey",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","bee"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"spider-rule",conditions:[{pred:"is-arachnid",args:["?x"],degVar:"?d1"},{pred:"spins-webs",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","spider"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"scorpion-rule",conditions:[{pred:"is-arachnid",args:["?x"],degVar:"?d1"},{pred:"has-stinger",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","scorpion"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"pangolin-rule",conditions:[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"has-scales",args:["?x"],degVar:"?d2"},{pred:"eats-insects",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"species",args:["?x","pangolin"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:40},{name:"armadillo-rule",conditions:[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"has-armor",args:["?x"],degVar:"?d2"},{pred:"burrows",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"species",args:["?x","armadillo"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:40},{name:"hedgehog-rule",conditions:[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"has-spines",args:["?x"],degVar:"?d2"},{pred:"is-nocturnal",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"species",args:["?x","hedgehog"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:40},{name:"porcupine-rule",conditions:[{pred:"is-rodent",args:["?x"],degVar:"?d1"},{pred:"has-quills",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","porcupine"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"raccoon-rule",conditions:[{pred:"is-nocturnal-mammal",args:["?x"],degVar:"?d1"},{pred:"is-omnivore",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"species",args:["?x","raccoon"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:40},{name:"otter-rule",conditions:[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"},{pred:"uses-tools",args:["?x"],degVar:"?d4"}],actions:[{type:"add",fact:{pred:"species",args:["?x","otter"],deg:["",.9,["min","?d1","?d2","?d3","?d4"]]}}],priority:40},{name:"sloth-rule",conditions:[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"climbs-trees",args:["?x"],degVar:"?d2"},{pred:"is-slow",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"species",args:["?x","sloth"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:40},{name:"moose-rule",conditions:[{pred:"is-ungulate",args:["?x"],degVar:"?d1"},{pred:"has-antlers",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"species",args:["?x","moose"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:40},{name:"deer-rule",conditions:[{pred:"is-ungulate",args:["?x"],degVar:"?d1"},{pred:"has-antlers",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"species",args:["?x","deer"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:40},{name:"hummingbird-rule",conditions:[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"is-small",args:["?x"],degVar:"?d2"},{pred:"hovers",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"species",args:["?x","hummingbird"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:40},{name:"pelican-rule",conditions:[{pred:"is-waterfowl",args:["?x"],degVar:"?d1"},{pred:"has-large-beak",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","pelican"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"woodpecker-rule",conditions:[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"pecks-wood",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","woodpecker"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40},{name:"alligator-rule",conditions:[{pred:"is-reptile",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"},{pred:"has-broad-snout",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"species",args:["?x","alligator"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:40},{name:"iguana-rule",conditions:[{pred:"is-reptile",args:["?x"],degVar:"?d1"},{pred:"has-legs",args:["?x"],degVar:"?d2"},{pred:"is-herbivore",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"species",args:["?x","iguana"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:40},{name:"gecko-rule",conditions:[{pred:"is-reptile",args:["?x"],degVar:"?d1"},{pred:"climbs-walls",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"species",args:["?x","gecko"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:40},{name:"dragonfly-rule",conditions:[{pred:"is-insect",args:["?x"],degVar:"?d1"},{pred:"has-wings",args:["?x"],degVar:"?d2"},{pred:"is-aquatic",args:["?x"],degVar:"?d3"}],actions:[{type:"add",fact:{pred:"species",args:["?x","dragonfly"],deg:["",.9,["min","?d1","?d2","?d3"]]}}],priority:40},{name:"beetle-rule",conditions:[{pred:"is-insect",args:["?x"],degVar:"?d1"},{pred:"has-hard-shell",args:["?x"],degVar:"?d2"}],actions:[{type:"add",fact:{pred:"species",args:["?x","beetle"],deg:["",.9,["min","?d1","?d2"]]}}],priority:40}];function e(g,r,a,d=40){let i=r.map(t=>t.degVar).filter(Boolean),s=i.length===1?["",.9,i[0]]:["",.9,["min",...i]];return{name:g,conditions:r.map(t=>({pred:t.pred,args:t.args,...t.degVar?{degVar:t.degVar}:{}})),actions:[{type:"add",fact:{pred:"species",args:["?x",a],deg:s}}],priority:d}}function o(g,r,a,d=50){let i=r.map(t=>t.degVar).filter(Boolean),s=i.length===1?["",.9,i[0]]:["",.9,["min",...i]];return{name:g,conditions:r.map(t=>({pred:t.pred,args:t.args,...t.degVar?{degVar:t.degVar}:{}})),actions:[{type:"add",fact:{pred:a,args:["?x"],deg:s}}],priority:d}}var he=[...Y,o("fish-base-rule",[{pred:"has-gills",args:["?x"],degVar:"?d1"},{pred:"has-fins",args:["?x"],degVar:"?d2"}],"is-fish",60),o("mollusk-base-rule",[{pred:"has-soft-body",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"}],"is-mollusk",60),o("crustacean-base-rule",[{pred:"has-exoskeleton",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"}],"is-crustacean",60),o("bird-from-eggs-feathers-rule",[{pred:"lays-eggs",args:["?x"],degVar:"?d1"},{pred:"has-feathers",args:["?x"],degVar:"?d2"}],"is-bird",60),o("mammal-from-hair-warm-rule",[{pred:"has-hair",args:["?x"],degVar:"?d1"},{pred:"is-warm-blooded",args:["?x"],degVar:"?d2"}],"is-mammal",60),o("venomous-rule",[{pred:"has-venom",args:["?x"],degVar:"?d1"},{pred:"has-fangs",args:["?x"],degVar:"?d2"}],"is-venomous",60),o("filter-feeder-rule",[{pred:"filter-feeds",args:["?x"],degVar:"?d1"}],"is-filter-feeder",60),o("echolocator-rule",[{pred:"echolocates",args:["?x"],degVar:"?d1"}],"uses-echolocation",60),o("migratory-rule",[{pred:"migrates",args:["?x"],degVar:"?d1"}],"is-migratory",60),o("bioluminescent-rule",[{pred:"produces-light",args:["?x"],degVar:"?d1"}],"is-bioluminescent",60),o("domesticated-rule",[{pred:"is-domesticated",args:["?x"],degVar:"?d1"}],"is-domestic",60),o("pack-animal-rule",[{pred:"hunts-in-packs",args:["?x"],degVar:"?d1"},{pred:"is-carnivore",args:["?x"],degVar:"?d2"}],"is-pack-hunter",60),o("parasitic-rule",[{pred:"is-parasitic",args:["?x"],degVar:"?d1"}],"is-parasite",60),o("symbiotic-rule",[{pred:"lives-symbiotically",args:["?x"],degVar:"?d1"}],"is-symbiont",60),o("shark-class-rule",[{pred:"is-fish",args:["?x"],degVar:"?d1"},{pred:"is-carnivore",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],"is-shark",50),o("ray-class-rule",[{pred:"is-fish",args:["?x"],degVar:"?d1"},{pred:"has-flat-body",args:["?x"],degVar:"?d2"}],"is-ray",50),o("reef-fish-rule",[{pred:"is-fish",args:["?x"],degVar:"?d1"},{pred:"lives-in-reef",args:["?x"],degVar:"?d2"}],"is-reef-fish",50),o("deep-sea-fish-rule",[{pred:"is-fish",args:["?x"],degVar:"?d1"},{pred:"lives-in-deep-sea",args:["?x"],degVar:"?d2"}],"is-deep-sea-fish",50),o("freshwater-fish-rule",[{pred:"is-fish",args:["?x"],degVar:"?d1"},{pred:"lives-in-freshwater",args:["?x"],degVar:"?d2"}],"is-freshwater-fish",50),o("cephalopod-rule",[{pred:"is-mollusk",args:["?x"],degVar:"?d1"},{pred:"has-tentacles",args:["?x"],degVar:"?d2"}],"is-cephalopod",50),o("bivalve-rule",[{pred:"is-mollusk",args:["?x"],degVar:"?d1"},{pred:"has-two-shells",args:["?x"],degVar:"?d2"}],"is-bivalve",50),o("gastropod-rule",[{pred:"is-mollusk",args:["?x"],degVar:"?d1"},{pred:"has-single-shell",args:["?x"],degVar:"?d2"}],"is-gastropod",50),o("decapod-rule",[{pred:"is-crustacean",args:["?x"],degVar:"?d1"},{pred:"has-ten-legs",args:["?x"],degVar:"?d2"}],"is-decapod",50),o("bovine-rule",[{pred:"is-ungulate",args:["?x"],degVar:"?d1"},{pred:"has-horns",args:["?x"],degVar:"?d2"}],"is-bovine",50),o("equine-rule",[{pred:"is-ungulate",args:["?x"],degVar:"?d1"},{pred:"has-mane",args:["?x"],degVar:"?d2"}],"is-equine",50),o("pachyderm-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"has-thick-skin",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],"is-pachyderm",50),o("mustelid-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-carnivore",args:["?x"],degVar:"?d2"},{pred:"has-elongated-body",args:["?x"],degVar:"?d3"}],"is-mustelid",50),o("ursine-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"},{pred:"has-claws",args:["?x"],degVar:"?d3"}],"is-ursine",50),o("lagomorph-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"has-long-ears",args:["?x"],degVar:"?d2"},{pred:"can-jump",args:["?x"],degVar:"?d3"}],"is-lagomorph",50),o("flying-insect-rule",[{pred:"is-insect",args:["?x"],degVar:"?d1"},{pred:"has-wings",args:["?x"],degVar:"?d2"}],"is-flying-insect",50),o("social-insect-rule",[{pred:"is-insect",args:["?x"],degVar:"?d1"},{pred:"lives-in-colony",args:["?x"],degVar:"?d2"}],"is-social-insect",50),o("wading-bird-rule",[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"has-long-legs",args:["?x"],degVar:"?d2"},{pred:"is-aquatic",args:["?x"],degVar:"?d3"}],"is-wading-bird",50),o("songbird-rule",[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"sings",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],"is-songbird",50),o("seabird-rule",[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"lives-near-coast",args:["?x"],degVar:"?d2"}],"is-seabird",50),o("tropical-bird-rule",[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"lives-in-tropics",args:["?x"],degVar:"?d2"},{pred:"has-bright-colors",args:["?x"],degVar:"?d3"}],"is-tropical-bird",50),o("jungle-mammal-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"lives-in-jungle",args:["?x"],degVar:"?d2"}],"is-jungle-mammal",50),o("savanna-mammal-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"lives-in-savanna",args:["?x"],degVar:"?d2"}],"is-savanna-mammal",50),o("tundra-mammal-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"lives-in-tundra",args:["?x"],degVar:"?d2"}],"is-tundra-mammal",50),o("cave-dweller-rule",[{pred:"lives-in-caves",args:["?x"],degVar:"?d1"},{pred:"is-nocturnal",args:["?x"],degVar:"?d2"}],"is-cave-dweller",50),o("arboreal-rule",[{pred:"climbs-trees",args:["?x"],degVar:"?d1"},{pred:"lives-in-trees",args:["?x"],degVar:"?d2"}],"is-arboreal",50),o("burrowing-mammal-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"burrows",args:["?x"],degVar:"?d2"}],"is-burrowing-mammal",50),o("monotreme-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"lays-eggs",args:["?x"],degVar:"?d2"}],"is-monotreme",50),o("venomous-snake-rule",[{pred:"is-reptile",args:["?x"],degVar:"?d1"},{pred:"has-no-legs",args:["?x"],degVar:"?d2"},{pred:"is-venomous",args:["?x"],degVar:"?d3"}],"is-venomous-snake",50),o("constrictor-rule",[{pred:"is-reptile",args:["?x"],degVar:"?d1"},{pred:"has-no-legs",args:["?x"],degVar:"?d2"},{pred:"constricts-prey",args:["?x"],degVar:"?d3"}],"is-constrictor",50),o("marine-reptile-rule",[{pred:"is-reptile",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"},{pred:"lives-in-ocean",args:["?x"],degVar:"?d3"}],"is-marine-reptile",50),o("aquatic-amphibian-rule",[{pred:"is-amphibian",args:["?x"],degVar:"?d1"},{pred:"lives-in-water",args:["?x"],degVar:"?d2"},{pred:"has-gills",args:["?x"],degVar:"?d3"}],"is-aquatic-amphibian",50),e("platypus-rule",[{pred:"is-monotreme",args:["?x"],degVar:"?d1"},{pred:"has-bill",args:["?x"],degVar:"?d2"},{pred:"is-aquatic",args:["?x"],degVar:"?d3"}],"platypus"),e("echidna-rule",[{pred:"is-monotreme",args:["?x"],degVar:"?d1"},{pred:"has-spines",args:["?x"],degVar:"?d2"}],"echidna"),e("wombat-rule",[{pred:"is-marsupial",args:["?x"],degVar:"?d1"},{pred:"burrows",args:["?x"],degVar:"?d2"}],"wombat"),e("opossum-rule",[{pred:"is-marsupial",args:["?x"],degVar:"?d1"},{pred:"plays-dead",args:["?x"],degVar:"?d2"}],"opossum"),e("tasmanian-devil-rule",[{pred:"is-marsupial",args:["?x"],degVar:"?d1"},{pred:"is-carnivore",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],"tasmanian-devil"),e("wallaby-rule",[{pred:"is-marsupial",args:["?x"],degVar:"?d1"},{pred:"can-jump",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],"wallaby"),e("sugar-glider-rule",[{pred:"is-marsupial",args:["?x"],degVar:"?d1"},{pred:"glides",args:["?x"],degVar:"?d2"}],"sugar-glider"),e("orangutan-rule",[{pred:"is-primate",args:["?x"],degVar:"?d1"},{pred:"is-arboreal",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],"orangutan"),e("lemur-rule",[{pred:"is-primate",args:["?x"],degVar:"?d1"},{pred:"has-long-tail",args:["?x"],degVar:"?d2"},{pred:"is-nocturnal",args:["?x"],degVar:"?d3"}],"lemur"),e("baboon-rule",[{pred:"is-primate",args:["?x"],degVar:"?d1"},{pred:"has-snout",args:["?x"],degVar:"?d2"}],"baboon"),e("gibbon-rule",[{pred:"is-primate",args:["?x"],degVar:"?d1"},{pred:"swings-from-branches",args:["?x"],degVar:"?d2"}],"gibbon"),e("mandrill-rule",[{pred:"is-primate",args:["?x"],degVar:"?d1"},{pred:"has-bright-face",args:["?x"],degVar:"?d2"}],"mandrill"),e("tarsier-rule",[{pred:"is-primate",args:["?x"],degVar:"?d1"},{pred:"has-large-eyes",args:["?x"],degVar:"?d2"},{pred:"is-nocturnal",args:["?x"],degVar:"?d3"}],"tarsier"),e("jaguar-rule",[{pred:"is-feline",args:["?x"],degVar:"?d1"},{pred:"has-spots",args:["?x"],degVar:"?d2"},{pred:"is-aquatic",args:["?x"],degVar:"?d3"}],"jaguar"),e("snow-leopard-rule",[{pred:"is-feline",args:["?x"],degVar:"?d1"},{pred:"lives-in-mountains",args:["?x"],degVar:"?d2"},{pred:"has-thick-fur",args:["?x"],degVar:"?d3"}],"snow-leopard"),e("lynx-rule",[{pred:"is-feline",args:["?x"],degVar:"?d1"},{pred:"has-tufted-ears",args:["?x"],degVar:"?d2"}],"lynx"),e("cougar-rule",[{pred:"is-feline",args:["?x"],degVar:"?d1"},{pred:"lives-in-mountains",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],"cougar"),e("serval-rule",[{pred:"is-feline",args:["?x"],degVar:"?d1"},{pred:"has-long-legs",args:["?x"],degVar:"?d2"},{pred:"lives-in-savanna",args:["?x"],degVar:"?d3"}],"serval"),e("ocelot-rule",[{pred:"is-feline",args:["?x"],degVar:"?d1"},{pred:"has-spots",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],"ocelot"),e("domestic-cat-rule",[{pred:"is-feline",args:["?x"],degVar:"?d1"},{pred:"is-domestic",args:["?x"],degVar:"?d2"}],"domestic-cat"),e("coyote-rule",[{pred:"is-canine",args:["?x"],degVar:"?d1"},{pred:"lives-in-desert",args:["?x"],degVar:"?d2"}],"coyote"),e("jackal-rule",[{pred:"is-canine",args:["?x"],degVar:"?d1"},{pred:"is-scavenger",args:["?x"],degVar:"?d2"}],"jackal"),e("domestic-dog-rule",[{pred:"is-canine",args:["?x"],degVar:"?d1"},{pred:"is-domestic",args:["?x"],degVar:"?d2"}],"domestic-dog"),e("african-wild-dog-rule",[{pred:"is-canine",args:["?x"],degVar:"?d1"},{pred:"hunts-in-packs",args:["?x"],degVar:"?d2"},{pred:"lives-in-savanna",args:["?x"],degVar:"?d3"}],"african-wild-dog"),e("arctic-fox-rule",[{pred:"is-canine",args:["?x"],degVar:"?d1"},{pred:"lives-in-arctic",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],"arctic-fox"),e("fennec-fox-rule",[{pred:"is-canine",args:["?x"],degVar:"?d1"},{pred:"lives-in-desert",args:["?x"],degVar:"?d2"},{pred:"has-large-ears",args:["?x"],degVar:"?d3"}],"fennec-fox"),e("grizzly-bear-rule",[{pred:"is-ursine",args:["?x"],degVar:"?d1"},{pred:"is-omnivore",args:["?x"],degVar:"?d2"},{pred:"lives-in-mountains",args:["?x"],degVar:"?d3"}],"grizzly-bear"),e("panda-rule",[{pred:"is-ursine",args:["?x"],degVar:"?d1"},{pred:"eats-bamboo",args:["?x"],degVar:"?d2"},{pred:"has-black-white-pattern",args:["?x"],degVar:"?d3"}],"panda"),e("sun-bear-rule",[{pred:"is-ursine",args:["?x"],degVar:"?d1"},{pred:"lives-in-tropics",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],"sun-bear"),e("black-bear-rule",[{pred:"is-ursine",args:["?x"],degVar:"?d1"},{pred:"climbs-trees",args:["?x"],degVar:"?d2"},{pred:"is-omnivore",args:["?x"],degVar:"?d3"}],"black-bear"),e("spectacled-bear-rule",[{pred:"is-ursine",args:["?x"],degVar:"?d1"},{pred:"lives-in-mountains",args:["?x"],degVar:"?d2"},{pred:"is-herbivore",args:["?x"],degVar:"?d3"}],"spectacled-bear"),e("weasel-rule",[{pred:"is-mustelid",args:["?x"],degVar:"?d1"},{pred:"is-small",args:["?x"],degVar:"?d2"}],"weasel"),e("badger-rule",[{pred:"is-mustelid",args:["?x"],degVar:"?d1"},{pred:"burrows",args:["?x"],degVar:"?d2"}],"badger"),e("wolverine-rule",[{pred:"is-mustelid",args:["?x"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"},{pred:"lives-in-tundra",args:["?x"],degVar:"?d3"}],"wolverine"),e("ferret-rule",[{pred:"is-mustelid",args:["?x"],degVar:"?d1"},{pred:"is-domestic",args:["?x"],degVar:"?d2"}],"ferret"),e("mink-rule",[{pred:"is-mustelid",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"}],"mink"),e("rabbit-rule",[{pred:"is-lagomorph",args:["?x"],degVar:"?d1"},{pred:"is-small",args:["?x"],degVar:"?d2"}],"rabbit"),e("hare-rule",[{pred:"is-lagomorph",args:["?x"],degVar:"?d1"},{pred:"is-fast",args:["?x"],degVar:"?d2"}],"hare"),e("pika-rule",[{pred:"is-lagomorph",args:["?x"],degVar:"?d1"},{pred:"lives-in-mountains",args:["?x"],degVar:"?d2"}],"pika"),e("narwhal-rule",[{pred:"is-cetacean",args:["?x"],degVar:"?d1"},{pred:"has-tusk",args:["?x"],degVar:"?d2"},{pred:"lives-in-arctic",args:["?x"],degVar:"?d3"}],"narwhal"),e("beluga-rule",[{pred:"is-cetacean",args:["?x"],degVar:"?d1"},{pred:"lives-in-arctic",args:["?x"],degVar:"?d2"},{pred:"is-white",args:["?x"],degVar:"?d3"}],"beluga"),e("humpback-whale-rule",[{pred:"is-cetacean",args:["?x"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"},{pred:"sings",args:["?x"],degVar:"?d3"}],"humpback-whale"),e("blue-whale-rule",[{pred:"is-cetacean",args:["?x"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"},{pred:"filter-feeds",args:["?x"],degVar:"?d3"}],"blue-whale"),e("sperm-whale-rule",[{pred:"is-cetacean",args:["?x"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"},{pred:"echolocates",args:["?x"],degVar:"?d3"}],"sperm-whale"),e("porpoise-rule",[{pred:"is-cetacean",args:["?x"],degVar:"?d1"},{pred:"is-small",args:["?x"],degVar:"?d2"}],"porpoise"),e("bottlenose-dolphin-rule",[{pred:"is-cetacean",args:["?x"],degVar:"?d1"},{pred:"is-playful",args:["?x"],degVar:"?d2"},{pred:"echolocates",args:["?x"],degVar:"?d3"}],"bottlenose-dolphin"),e("walrus-rule",[{pred:"is-pinniped",args:["?x"],degVar:"?d1"},{pred:"has-tusks",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],"walrus"),e("elephant-seal-rule",[{pred:"is-pinniped",args:["?x"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"},{pred:"has-large-nose",args:["?x"],degVar:"?d3"}],"elephant-seal"),e("fur-seal-rule",[{pred:"is-pinniped",args:["?x"],degVar:"?d1"},{pred:"has-thick-fur",args:["?x"],degVar:"?d2"}],"fur-seal"),e("cow-rule",[{pred:"is-bovine",args:["?x"],degVar:"?d1"},{pred:"is-domestic",args:["?x"],degVar:"?d2"}],"cow"),e("buffalo-rule",[{pred:"is-bovine",args:["?x"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"},{pred:"lives-in-savanna",args:["?x"],degVar:"?d3"}],"buffalo"),e("bison-rule",[{pred:"is-bovine",args:["?x"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"},{pred:"lives-in-grassland",args:["?x"],degVar:"?d3"}],"bison"),e("goat-rule",[{pred:"is-bovine",args:["?x"],degVar:"?d1"},{pred:"lives-in-mountains",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],"mountain-goat"),e("sheep-rule",[{pred:"is-bovine",args:["?x"],degVar:"?d1"},{pred:"has-wool",args:["?x"],degVar:"?d2"}],"sheep"),e("yak-rule",[{pred:"is-bovine",args:["?x"],degVar:"?d1"},{pred:"lives-in-mountains",args:["?x"],degVar:"?d2"},{pred:"has-thick-fur",args:["?x"],degVar:"?d3"}],"yak"),e("okapi-rule",[{pred:"is-ungulate",args:["?x"],degVar:"?d1"},{pred:"has-stripes",args:["?x"],degVar:"?d2"},{pred:"lives-in-jungle",args:["?x"],degVar:"?d3"}],"okapi"),e("donkey-rule",[{pred:"is-equine",args:["?x"],degVar:"?d1"},{pred:"has-long-ears",args:["?x"],degVar:"?d2"}],"donkey"),e("mule-rule",[{pred:"is-equine",args:["?x"],degVar:"?d1"},{pred:"is-sterile",args:["?x"],degVar:"?d2"}],"mule"),e("antelope-rule",[{pred:"is-ungulate",args:["?x"],degVar:"?d1"},{pred:"is-fast",args:["?x"],degVar:"?d2"},{pred:"lives-in-savanna",args:["?x"],degVar:"?d3"}],"antelope"),e("gazelle-rule",[{pred:"is-ungulate",args:["?x"],degVar:"?d1"},{pred:"is-fast",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],"gazelle"),e("wildebeest-rule",[{pred:"is-ungulate",args:["?x"],degVar:"?d1"},{pred:"migrates",args:["?x"],degVar:"?d2"},{pred:"lives-in-savanna",args:["?x"],degVar:"?d3"}],"wildebeest"),e("llama-rule",[{pred:"is-ungulate",args:["?x"],degVar:"?d1"},{pred:"lives-in-mountains",args:["?x"],degVar:"?d2"},{pred:"is-domestic",args:["?x"],degVar:"?d3"}],"llama"),e("alpaca-rule",[{pred:"is-ungulate",args:["?x"],degVar:"?d1"},{pred:"has-wool",args:["?x"],degVar:"?d2"},{pred:"lives-in-mountains",args:["?x"],degVar:"?d3"}],"alpaca"),e("african-elephant-rule",[{pred:"is-pachyderm",args:["?x"],degVar:"?d1"},{pred:"has-trunk",args:["?x"],degVar:"?d2"},{pred:"has-large-ears",args:["?x"],degVar:"?d3"}],"african-elephant"),e("asian-elephant-rule",[{pred:"is-pachyderm",args:["?x"],degVar:"?d1"},{pred:"has-trunk",args:["?x"],degVar:"?d2"},{pred:"has-small-ears",args:["?x"],degVar:"?d3"}],"asian-elephant"),e("white-rhino-rule",[{pred:"is-pachyderm",args:["?x"],degVar:"?d1"},{pred:"has-horn",args:["?x"],degVar:"?d2"},{pred:"has-wide-mouth",args:["?x"],degVar:"?d3"}],"white-rhinoceros"),e("black-rhino-rule",[{pred:"is-pachyderm",args:["?x"],degVar:"?d1"},{pred:"has-horn",args:["?x"],degVar:"?d2"},{pred:"has-pointed-lip",args:["?x"],degVar:"?d3"}],"black-rhinoceros"),e("mole-rule",[{pred:"is-burrowing-mammal",args:["?x"],degVar:"?d1"},{pred:"is-small",args:["?x"],degVar:"?d2"},{pred:"has-poor-eyesight",args:["?x"],degVar:"?d3"}],"mole"),e("prairie-dog-rule",[{pred:"is-burrowing-mammal",args:["?x"],degVar:"?d1"},{pred:"lives-in-colony",args:["?x"],degVar:"?d2"}],"prairie-dog"),e("groundhog-rule",[{pred:"is-burrowing-mammal",args:["?x"],degVar:"?d1"},{pred:"hibernates",args:["?x"],degVar:"?d2"}],"groundhog"),e("gopher-rule",[{pred:"is-burrowing-mammal",args:["?x"],degVar:"?d1"},{pred:"has-cheek-pouches",args:["?x"],degVar:"?d2"}],"gopher"),e("capybara-rule",[{pred:"is-rodent",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],"capybara"),e("hamster-rule",[{pred:"is-rodent",args:["?x"],degVar:"?d1"},{pred:"has-cheek-pouches",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],"hamster"),e("mouse-rule",[{pred:"is-rodent",args:["?x"],degVar:"?d1"},{pred:"is-small",args:["?x"],degVar:"?d2"},{pred:"is-nocturnal",args:["?x"],degVar:"?d3"}],"mouse"),e("rat-rule",[{pred:"is-rodent",args:["?x"],degVar:"?d1"},{pred:"has-long-tail",args:["?x"],degVar:"?d2"}],"rat"),e("chinchilla-rule",[{pred:"is-rodent",args:["?x"],degVar:"?d1"},{pred:"has-soft-fur",args:["?x"],degVar:"?d2"}],"chinchilla"),e("guinea-pig-rule",[{pred:"is-rodent",args:["?x"],degVar:"?d1"},{pred:"is-domestic",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],"guinea-pig"),e("flying-squirrel-rule",[{pred:"is-rodent",args:["?x"],degVar:"?d1"},{pred:"glides",args:["?x"],degVar:"?d2"}],"flying-squirrel"),e("manatee-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"},{pred:"is-herbivore",args:["?x"],degVar:"?d3"},{pred:"is-large",args:["?x"],degVar:"?d4"}],"manatee"),e("hyena-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-scavenger",args:["?x"],degVar:"?d2"},{pred:"hunts-in-packs",args:["?x"],degVar:"?d3"}],"hyena"),e("meerkat-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"lives-in-desert",args:["?x"],degVar:"?d2"},{pred:"lives-in-colony",args:["?x"],degVar:"?d3"}],"meerkat"),e("aardvark-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"eats-insects",args:["?x"],degVar:"?d2"},{pred:"has-long-snout",args:["?x"],degVar:"?d3"}],"aardvark"),e("anteater-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"eats-insects",args:["?x"],degVar:"?d2"},{pred:"has-long-tongue",args:["?x"],degVar:"?d3"}],"anteater"),e("tapir-rule",[{pred:"is-ungulate",args:["?x"],degVar:"?d1"},{pred:"has-short-trunk",args:["?x"],degVar:"?d2"},{pred:"lives-in-jungle",args:["?x"],degVar:"?d3"}],"tapir"),e("red-panda-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-arboreal",args:["?x"],degVar:"?d2"},{pred:"has-red-fur",args:["?x"],degVar:"?d3"}],"red-panda"),e("mongoose-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-carnivore",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"},{pred:"is-fast",args:["?x"],degVar:"?d4"}],"mongoose"),e("skunk-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"sprays-scent",args:["?x"],degVar:"?d2"}],"skunk"),e("fruit-bat-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"can-fly",args:["?x"],degVar:"?d2"},{pred:"eats-fruit",args:["?x"],degVar:"?d3"}],"fruit-bat"),e("vampire-bat-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"can-fly",args:["?x"],degVar:"?d2"},{pred:"drinks-blood",args:["?x"],degVar:"?d3"}],"vampire-bat"),e("bald-eagle-rule",[{pred:"is-raptor",args:["?x"],degVar:"?d1"},{pred:"has-white-head",args:["?x"],degVar:"?d2"}],"bald-eagle"),e("golden-eagle-rule",[{pred:"is-raptor",args:["?x"],degVar:"?d1"},{pred:"lives-in-mountains",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],"golden-eagle"),e("osprey-rule",[{pred:"is-raptor",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"}],"osprey"),e("vulture-rule",[{pred:"is-raptor",args:["?x"],degVar:"?d1"},{pred:"is-scavenger",args:["?x"],degVar:"?d2"}],"vulture"),e("condor-rule",[{pred:"is-raptor",args:["?x"],degVar:"?d1"},{pred:"is-scavenger",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],"condor"),e("kestrel-rule",[{pred:"is-raptor",args:["?x"],degVar:"?d1"},{pred:"hovers",args:["?x"],degVar:"?d2"}],"kestrel"),e("harpy-eagle-rule",[{pred:"is-raptor",args:["?x"],degVar:"?d1"},{pred:"lives-in-jungle",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],"harpy-eagle"),e("emu-rule",[{pred:"is-flightless-bird",args:["?x"],degVar:"?d1"},{pred:"lives-in-grassland",args:["?x"],degVar:"?d2"}],"emu"),e("cassowary-rule",[{pred:"is-flightless-bird",args:["?x"],degVar:"?d1"},{pred:"has-casque",args:["?x"],degVar:"?d2"},{pred:"lives-in-jungle",args:["?x"],degVar:"?d3"}],"cassowary"),e("kiwi-rule",[{pred:"is-flightless-bird",args:["?x"],degVar:"?d1"},{pred:"is-small",args:["?x"],degVar:"?d2"},{pred:"is-nocturnal",args:["?x"],degVar:"?d3"}],"kiwi"),e("rhea-rule",[{pred:"is-flightless-bird",args:["?x"],degVar:"?d1"},{pred:"lives-in-grassland",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],"rhea"),e("swan-rule",[{pred:"is-waterfowl",args:["?x"],degVar:"?d1"},{pred:"has-long-neck",args:["?x"],degVar:"?d2"},{pred:"is-white",args:["?x"],degVar:"?d3"}],"swan"),e("goose-rule",[{pred:"is-waterfowl",args:["?x"],degVar:"?d1"},{pred:"migrates",args:["?x"],degVar:"?d2"}],"goose"),e("heron-rule",[{pred:"is-wading-bird",args:["?x"],degVar:"?d1"},{pred:"has-long-neck",args:["?x"],degVar:"?d2"}],"heron"),e("crane-rule",[{pred:"is-wading-bird",args:["?x"],degVar:"?d1"},{pred:"migrates",args:["?x"],degVar:"?d2"}],"crane"),e("stork-rule",[{pred:"is-wading-bird",args:["?x"],degVar:"?d1"},{pred:"has-large-beak",args:["?x"],degVar:"?d2"}],"stork"),e("ibis-rule",[{pred:"is-wading-bird",args:["?x"],degVar:"?d1"},{pred:"has-curved-beak",args:["?x"],degVar:"?d2"}],"ibis"),e("spoonbill-rule",[{pred:"is-wading-bird",args:["?x"],degVar:"?d1"},{pred:"has-flat-beak",args:["?x"],degVar:"?d2"}],"spoonbill"),e("albatross-rule",[{pred:"is-seabird",args:["?x"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"},{pred:"has-long-wingspan",args:["?x"],degVar:"?d3"}],"albatross"),e("puffin-rule",[{pred:"is-seabird",args:["?x"],degVar:"?d1"},{pred:"has-bright-colors",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],"puffin"),e("seagull-rule",[{pred:"is-seabird",args:["?x"],degVar:"?d1"},{pred:"is-scavenger",args:["?x"],degVar:"?d2"}],"seagull"),e("toucan-rule",[{pred:"is-tropical-bird",args:["?x"],degVar:"?d1"},{pred:"has-large-beak",args:["?x"],degVar:"?d2"}],"toucan"),e("macaw-rule",[{pred:"is-tropical-bird",args:["?x"],degVar:"?d1"},{pred:"can-talk",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],"macaw"),e("cockatoo-rule",[{pred:"is-tropical-bird",args:["?x"],degVar:"?d1"},{pred:"has-crest",args:["?x"],degVar:"?d2"}],"cockatoo"),e("bird-of-paradise-rule",[{pred:"is-tropical-bird",args:["?x"],degVar:"?d1"},{pred:"has-elaborate-plumage",args:["?x"],degVar:"?d2"}],"bird-of-paradise"),e("kingfisher-rule",[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"},{pred:"has-bright-colors",args:["?x"],degVar:"?d3"},{pred:"is-small",args:["?x"],degVar:"?d4"}],"kingfisher"),e("robin-rule",[{pred:"is-songbird",args:["?x"],degVar:"?d1"},{pred:"has-red-breast",args:["?x"],degVar:"?d2"}],"robin"),e("canary-rule",[{pred:"is-songbird",args:["?x"],degVar:"?d1"},{pred:"is-yellow",args:["?x"],degVar:"?d2"}],"canary"),e("nightingale-rule",[{pred:"is-songbird",args:["?x"],degVar:"?d1"},{pred:"is-nocturnal",args:["?x"],degVar:"?d2"}],"nightingale"),e("sparrow-rule",[{pred:"is-songbird",args:["?x"],degVar:"?d1"},{pred:"lives-near-humans",args:["?x"],degVar:"?d2"}],"sparrow"),e("finch-rule",[{pred:"is-songbird",args:["?x"],degVar:"?d1"},{pred:"has-thick-beak",args:["?x"],degVar:"?d2"}],"finch"),e("peacock-rule",[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"has-elaborate-plumage",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],"peacock"),e("pigeon-rule",[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"lives-near-humans",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],"pigeon"),e("roadrunner-rule",[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"is-fast",args:["?x"],degVar:"?d2"},{pred:"lives-in-desert",args:["?x"],degVar:"?d3"}],"roadrunner"),e("cobra-rule",[{pred:"is-venomous-snake",args:["?x"],degVar:"?d1"},{pred:"has-hood",args:["?x"],degVar:"?d2"}],"cobra"),e("rattlesnake-rule",[{pred:"is-venomous-snake",args:["?x"],degVar:"?d1"},{pred:"has-rattle",args:["?x"],degVar:"?d2"}],"rattlesnake"),e("mamba-rule",[{pred:"is-venomous-snake",args:["?x"],degVar:"?d1"},{pred:"is-fast",args:["?x"],degVar:"?d2"},{pred:"lives-in-savanna",args:["?x"],degVar:"?d3"}],"mamba"),e("viper-rule",[{pred:"is-venomous-snake",args:["?x"],degVar:"?d1"},{pred:"has-triangular-head",args:["?x"],degVar:"?d2"}],"viper"),e("python-rule",[{pred:"is-constrictor",args:["?x"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"},{pred:"lives-in-tropics",args:["?x"],degVar:"?d3"}],"python"),e("boa-rule",[{pred:"is-constrictor",args:["?x"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"},{pred:"lives-in-jungle",args:["?x"],degVar:"?d3"}],"boa-constrictor"),e("anaconda-rule",[{pred:"is-constrictor",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],"anaconda"),e("coral-snake-rule",[{pred:"is-venomous-snake",args:["?x"],degVar:"?d1"},{pred:"has-bright-colors",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],"coral-snake"),e("king-snake-rule",[{pred:"is-reptile",args:["?x"],degVar:"?d1"},{pred:"has-no-legs",args:["?x"],degVar:"?d2"},{pred:"eats-snakes",args:["?x"],degVar:"?d3"}],"king-snake"),e("sea-snake-rule",[{pred:"is-marine-reptile",args:["?x"],degVar:"?d1"},{pred:"has-no-legs",args:["?x"],degVar:"?d2"},{pred:"is-venomous",args:["?x"],degVar:"?d3"}],"sea-snake"),e("komodo-dragon-rule",[{pred:"is-reptile",args:["?x"],degVar:"?d1"},{pred:"has-legs",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"},{pred:"is-carnivore",args:["?x"],degVar:"?d4"}],"komodo-dragon"),e("monitor-lizard-rule",[{pred:"is-reptile",args:["?x"],degVar:"?d1"},{pred:"has-legs",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"},{pred:"has-forked-tongue",args:["?x"],degVar:"?d4"}],"monitor-lizard"),e("bearded-dragon-rule",[{pred:"is-reptile",args:["?x"],degVar:"?d1"},{pred:"has-legs",args:["?x"],degVar:"?d2"},{pred:"has-beard",args:["?x"],degVar:"?d3"}],"bearded-dragon"),e("skink-rule",[{pred:"is-reptile",args:["?x"],degVar:"?d1"},{pred:"has-legs",args:["?x"],degVar:"?d2"},{pred:"has-smooth-scales",args:["?x"],degVar:"?d3"}],"skink"),e("horned-lizard-rule",[{pred:"is-reptile",args:["?x"],degVar:"?d1"},{pred:"has-horns",args:["?x"],degVar:"?d2"},{pred:"lives-in-desert",args:["?x"],degVar:"?d3"}],"horned-lizard"),e("leatherback-turtle-rule",[{pred:"is-turtle",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],"leatherback-turtle"),e("box-turtle-rule",[{pred:"is-turtle",args:["?x"],degVar:"?d1"},{pred:"lives-on-land",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],"box-turtle"),e("snapping-turtle-rule",[{pred:"is-turtle",args:["?x"],degVar:"?d1"},{pred:"is-carnivore",args:["?x"],degVar:"?d2"}],"snapping-turtle"),e("gharial-rule",[{pred:"is-reptile",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"},{pred:"has-narrow-snout",args:["?x"],degVar:"?d3"}],"gharial"),e("caiman-rule",[{pred:"is-reptile",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"},{pred:"lives-in-jungle",args:["?x"],degVar:"?d3"},{pred:"is-small",args:["?x"],degVar:"?d4"}],"caiman"),e("axolotl-rule",[{pred:"is-aquatic-amphibian",args:["?x"],degVar:"?d1"},{pred:"has-external-gills",args:["?x"],degVar:"?d2"}],"axolotl"),e("newt-rule",[{pred:"is-amphibian",args:["?x"],degVar:"?d1"},{pred:"has-tail",args:["?x"],degVar:"?d2"},{pred:"is-aquatic",args:["?x"],degVar:"?d3"}],"newt"),e("tree-frog-rule",[{pred:"is-amphibian",args:["?x"],degVar:"?d1"},{pred:"can-jump",args:["?x"],degVar:"?d2"},{pred:"climbs-trees",args:["?x"],degVar:"?d3"}],"tree-frog"),e("poison-dart-frog-rule",[{pred:"is-amphibian",args:["?x"],degVar:"?d1"},{pred:"has-bright-colors",args:["?x"],degVar:"?d2"},{pred:"is-venomous",args:["?x"],degVar:"?d3"}],"poison-dart-frog"),e("bullfrog-rule",[{pred:"is-amphibian",args:["?x"],degVar:"?d1"},{pred:"can-jump",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],"bullfrog"),e("caecilian-rule",[{pred:"is-amphibian",args:["?x"],degVar:"?d1"},{pred:"has-no-legs",args:["?x"],degVar:"?d2"}],"caecilian"),e("great-white-shark-rule",[{pred:"is-shark",args:["?x"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"}],"great-white-shark"),e("hammerhead-shark-rule",[{pred:"is-shark",args:["?x"],degVar:"?d1"},{pred:"has-flat-head",args:["?x"],degVar:"?d2"}],"hammerhead-shark"),e("whale-shark-rule",[{pred:"is-shark",args:["?x"],degVar:"?d1"},{pred:"filter-feeds",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],"whale-shark"),e("tiger-shark-rule",[{pred:"is-shark",args:["?x"],degVar:"?d1"},{pred:"has-stripes",args:["?x"],degVar:"?d2"}],"tiger-shark"),e("mako-shark-rule",[{pred:"is-shark",args:["?x"],degVar:"?d1"},{pred:"is-fast",args:["?x"],degVar:"?d2"}],"mako-shark"),e("nurse-shark-rule",[{pred:"is-shark",args:["?x"],degVar:"?d1"},{pred:"is-docile",args:["?x"],degVar:"?d2"}],"nurse-shark"),e("manta-ray-rule",[{pred:"is-ray",args:["?x"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"}],"manta-ray"),e("stingray-rule",[{pred:"is-ray",args:["?x"],degVar:"?d1"},{pred:"has-stinger",args:["?x"],degVar:"?d2"}],"stingray"),e("electric-ray-rule",[{pred:"is-ray",args:["?x"],degVar:"?d1"},{pred:"produces-electricity",args:["?x"],degVar:"?d2"}],"electric-ray"),e("clownfish-rule",[{pred:"is-reef-fish",args:["?x"],degVar:"?d1"},{pred:"lives-symbiotically",args:["?x"],degVar:"?d2"}],"clownfish"),e("angelfish-rule",[{pred:"is-reef-fish",args:["?x"],degVar:"?d1"},{pred:"has-bright-colors",args:["?x"],degVar:"?d2"}],"angelfish"),e("lionfish-rule",[{pred:"is-reef-fish",args:["?x"],degVar:"?d1"},{pred:"is-venomous",args:["?x"],degVar:"?d2"},{pred:"has-spines",args:["?x"],degVar:"?d3"}],"lionfish"),e("parrotfish-rule",[{pred:"is-reef-fish",args:["?x"],degVar:"?d1"},{pred:"has-beak-like-mouth",args:["?x"],degVar:"?d2"}],"parrotfish"),e("swordfish-rule",[{pred:"is-fish",args:["?x"],degVar:"?d1"},{pred:"has-sword-nose",args:["?x"],degVar:"?d2"},{pred:"is-fast",args:["?x"],degVar:"?d3"}],"swordfish"),e("seahorse-rule",[{pred:"is-fish",args:["?x"],degVar:"?d1"},{pred:"swims-upright",args:["?x"],degVar:"?d2"}],"seahorse"),e("pufferfish-rule",[{pred:"is-fish",args:["?x"],degVar:"?d1"},{pred:"inflates",args:["?x"],degVar:"?d2"}],"pufferfish"),e("anglerfish-rule",[{pred:"is-deep-sea-fish",args:["?x"],degVar:"?d1"},{pred:"is-bioluminescent",args:["?x"],degVar:"?d2"}],"anglerfish"),e("salmon-rule",[{pred:"is-freshwater-fish",args:["?x"],degVar:"?d1"},{pred:"migrates",args:["?x"],degVar:"?d2"}],"salmon"),e("trout-rule",[{pred:"is-freshwater-fish",args:["?x"],degVar:"?d1"},{pred:"has-spots",args:["?x"],degVar:"?d2"}],"trout"),e("catfish-rule",[{pred:"is-freshwater-fish",args:["?x"],degVar:"?d1"},{pred:"has-barbels",args:["?x"],degVar:"?d2"}],"catfish"),e("piranha-rule",[{pred:"is-freshwater-fish",args:["?x"],degVar:"?d1"},{pred:"is-carnivore",args:["?x"],degVar:"?d2"},{pred:"has-sharp-teeth",args:["?x"],degVar:"?d3"}],"piranha"),e("electric-eel-rule",[{pred:"is-freshwater-fish",args:["?x"],degVar:"?d1"},{pred:"produces-electricity",args:["?x"],degVar:"?d2"}],"electric-eel"),e("tuna-rule",[{pred:"is-fish",args:["?x"],degVar:"?d1"},{pred:"is-fast",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],"tuna"),e("flying-fish-rule",[{pred:"is-fish",args:["?x"],degVar:"?d1"},{pred:"can-fly",args:["?x"],degVar:"?d2"}],"flying-fish"),e("barracuda-rule",[{pred:"is-fish",args:["?x"],degVar:"?d1"},{pred:"is-fast",args:["?x"],degVar:"?d2"},{pred:"has-sharp-teeth",args:["?x"],degVar:"?d3"}],"barracuda"),e("octopus-rule",[{pred:"is-cephalopod",args:["?x"],degVar:"?d1"},{pred:"has-eight-legs",args:["?x"],degVar:"?d2"}],"octopus"),e("squid-rule",[{pred:"is-cephalopod",args:["?x"],degVar:"?d1"},{pred:"has-ten-legs",args:["?x"],degVar:"?d2"}],"squid"),e("giant-squid-rule",[{pred:"is-cephalopod",args:["?x"],degVar:"?d1"},{pred:"has-ten-legs",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"},{pred:"lives-in-deep-sea",args:["?x"],degVar:"?d4"}],"giant-squid"),e("cuttlefish-rule",[{pred:"is-cephalopod",args:["?x"],degVar:"?d1"},{pred:"changes-color",args:["?x"],degVar:"?d2"}],"cuttlefish"),e("nautilus-rule",[{pred:"is-cephalopod",args:["?x"],degVar:"?d1"},{pred:"has-external-shell",args:["?x"],degVar:"?d2"}],"nautilus"),e("oyster-rule",[{pred:"is-bivalve",args:["?x"],degVar:"?d1"},{pred:"produces-pearls",args:["?x"],degVar:"?d2"}],"oyster"),e("mussel-rule",[{pred:"is-bivalve",args:["?x"],degVar:"?d1"},{pred:"lives-in-colony",args:["?x"],degVar:"?d2"}],"mussel"),e("clam-rule",[{pred:"is-bivalve",args:["?x"],degVar:"?d1"},{pred:"burrows",args:["?x"],degVar:"?d2"}],"clam"),e("scallop-rule",[{pred:"is-bivalve",args:["?x"],degVar:"?d1"},{pred:"can-swim",args:["?x"],degVar:"?d2"}],"scallop"),e("snail-rule",[{pred:"is-gastropod",args:["?x"],degVar:"?d1"},{pred:"lives-on-land",args:["?x"],degVar:"?d2"}],"snail"),e("slug-rule",[{pred:"is-mollusk",args:["?x"],degVar:"?d1"},{pred:"lives-on-land",args:["?x"],degVar:"?d2"},{pred:"has-no-shell",args:["?x"],degVar:"?d3"}],"slug"),e("sea-slug-rule",[{pred:"is-gastropod",args:["?x"],degVar:"?d1"},{pred:"has-bright-colors",args:["?x"],degVar:"?d2"},{pred:"lives-in-ocean",args:["?x"],degVar:"?d3"}],"sea-slug"),e("lobster-rule",[{pred:"is-decapod",args:["?x"],degVar:"?d1"},{pred:"has-claws",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],"lobster"),e("crab-rule",[{pred:"is-decapod",args:["?x"],degVar:"?d1"},{pred:"has-claws",args:["?x"],degVar:"?d2"}],"crab"),e("shrimp-rule",[{pred:"is-decapod",args:["?x"],degVar:"?d1"},{pred:"is-small",args:["?x"],degVar:"?d2"}],"shrimp"),e("hermit-crab-rule",[{pred:"is-decapod",args:["?x"],degVar:"?d1"},{pred:"uses-borrowed-shell",args:["?x"],degVar:"?d2"}],"hermit-crab"),e("mantis-shrimp-rule",[{pred:"is-crustacean",args:["?x"],degVar:"?d1"},{pred:"has-powerful-strike",args:["?x"],degVar:"?d2"},{pred:"has-bright-colors",args:["?x"],degVar:"?d3"}],"mantis-shrimp"),e("barnacle-rule",[{pred:"is-crustacean",args:["?x"],degVar:"?d1"},{pred:"is-sessile",args:["?x"],degVar:"?d2"}],"barnacle"),e("krill-rule",[{pred:"is-crustacean",args:["?x"],degVar:"?d1"},{pred:"is-small",args:["?x"],degVar:"?d2"},{pred:"lives-in-colony",args:["?x"],degVar:"?d3"}],"krill"),e("moth-rule",[{pred:"is-flying-insect",args:["?x"],degVar:"?d1"},{pred:"is-nocturnal",args:["?x"],degVar:"?d2"}],"moth"),e("firefly-rule",[{pred:"is-flying-insect",args:["?x"],degVar:"?d1"},{pred:"is-bioluminescent",args:["?x"],degVar:"?d2"}],"firefly"),e("mosquito-rule",[{pred:"is-flying-insect",args:["?x"],degVar:"?d1"},{pred:"drinks-blood",args:["?x"],degVar:"?d2"}],"mosquito"),e("wasp-rule",[{pred:"is-flying-insect",args:["?x"],degVar:"?d1"},{pred:"has-stinger",args:["?x"],degVar:"?d2"},{pred:"is-carnivore",args:["?x"],degVar:"?d3"}],"wasp"),e("ladybug-rule",[{pred:"is-insect",args:["?x"],degVar:"?d1"},{pred:"has-spots",args:["?x"],degVar:"?d2"},{pred:"has-bright-colors",args:["?x"],degVar:"?d3"}],"ladybug"),e("praying-mantis-rule",[{pred:"is-insect",args:["?x"],degVar:"?d1"},{pred:"is-carnivore",args:["?x"],degVar:"?d2"},{pred:"has-grasping-forelegs",args:["?x"],degVar:"?d3"}],"praying-mantis"),e("grasshopper-rule",[{pred:"is-insect",args:["?x"],degVar:"?d1"},{pred:"can-jump",args:["?x"],degVar:"?d2"},{pred:"is-herbivore",args:["?x"],degVar:"?d3"}],"grasshopper"),e("cricket-rule",[{pred:"is-insect",args:["?x"],degVar:"?d1"},{pred:"can-jump",args:["?x"],degVar:"?d2"},{pred:"chirps",args:["?x"],degVar:"?d3"}],"cricket"),e("cockroach-rule",[{pred:"is-insect",args:["?x"],degVar:"?d1"},{pred:"is-nocturnal",args:["?x"],degVar:"?d2"},{pred:"is-fast",args:["?x"],degVar:"?d3"}],"cockroach"),e("termite-rule",[{pred:"is-social-insect",args:["?x"],degVar:"?d1"},{pred:"eats-wood",args:["?x"],degVar:"?d2"}],"termite"),e("cicada-rule",[{pred:"is-insect",args:["?x"],degVar:"?d1"},{pred:"is-loud",args:["?x"],degVar:"?d2"},{pred:"lives-underground",args:["?x"],degVar:"?d3"}],"cicada"),e("stick-insect-rule",[{pred:"is-insect",args:["?x"],degVar:"?d1"},{pred:"uses-camouflage",args:["?x"],degVar:"?d2"},{pred:"has-elongated-body",args:["?x"],degVar:"?d3"}],"stick-insect"),e("dung-beetle-rule",[{pred:"is-insect",args:["?x"],degVar:"?d1"},{pred:"rolls-dung",args:["?x"],degVar:"?d2"}],"dung-beetle"),e("weevil-rule",[{pred:"is-insect",args:["?x"],degVar:"?d1"},{pred:"has-long-snout",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],"weevil"),e("tarantula-rule",[{pred:"is-arachnid",args:["?x"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"},{pred:"has-hair",args:["?x"],degVar:"?d3"}],"tarantula"),e("black-widow-rule",[{pred:"is-arachnid",args:["?x"],degVar:"?d1"},{pred:"is-venomous",args:["?x"],degVar:"?d2"},{pred:"has-red-markings",args:["?x"],degVar:"?d3"}],"black-widow"),e("tick-rule",[{pred:"is-arachnid",args:["?x"],degVar:"?d1"},{pred:"is-parasite",args:["?x"],degVar:"?d2"}],"tick"),e("jellyfish-rule",[{pred:"is-aquatic",args:["?x"],degVar:"?d1"},{pred:"has-tentacles",args:["?x"],degVar:"?d2"},{pred:"has-no-brain",args:["?x"],degVar:"?d3"}],"jellyfish"),e("starfish-rule",[{pred:"is-aquatic",args:["?x"],degVar:"?d1"},{pred:"has-five-arms",args:["?x"],degVar:"?d2"}],"starfish"),e("sea-urchin-rule",[{pred:"is-aquatic",args:["?x"],degVar:"?d1"},{pred:"has-spines",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],"sea-urchin"),e("sea-cucumber-rule",[{pred:"is-aquatic",args:["?x"],degVar:"?d1"},{pred:"has-soft-body",args:["?x"],degVar:"?d2"},{pred:"lives-on-ocean-floor",args:["?x"],degVar:"?d3"}],"sea-cucumber"),e("coral-rule",[{pred:"is-aquatic",args:["?x"],degVar:"?d1"},{pred:"is-sessile",args:["?x"],degVar:"?d2"},{pred:"lives-in-colony",args:["?x"],degVar:"?d3"}],"coral"),e("sea-anemone-rule",[{pred:"is-aquatic",args:["?x"],degVar:"?d1"},{pred:"has-tentacles",args:["?x"],degVar:"?d2"},{pred:"is-sessile",args:["?x"],degVar:"?d3"}],"sea-anemone"),e("sponge-rule",[{pred:"is-aquatic",args:["?x"],degVar:"?d1"},{pred:"is-sessile",args:["?x"],degVar:"?d2"},{pred:"filter-feeds",args:["?x"],degVar:"?d3"}],"sponge"),e("earthworm-rule",[{pred:"lives-on-land",args:["?x"],degVar:"?d1"},{pred:"burrows",args:["?x"],degVar:"?d2"},{pred:"has-no-legs",args:["?x"],degVar:"?d3"},{pred:"has-segments",args:["?x"],degVar:"?d4"}],"earthworm"),e("leech-rule",[{pred:"is-aquatic",args:["?x"],degVar:"?d1"},{pred:"is-parasite",args:["?x"],degVar:"?d2"},{pred:"has-segments",args:["?x"],degVar:"?d3"}],"leech"),e("chicken-rule",[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"is-domestic",args:["?x"],degVar:"?d2"},{pred:"cannot-fly",args:["?x"],degVar:"?d3"}],"chicken"),e("turkey-rule",[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"is-domestic",args:["?x"],degVar:"?d2"},{pred:"has-wattle",args:["?x"],degVar:"?d3"}],"turkey"),e("domestic-goose-rule",[{pred:"is-waterfowl",args:["?x"],degVar:"?d1"},{pred:"is-domestic",args:["?x"],degVar:"?d2"}],"domestic-goose"),e("goldfish-rule",[{pred:"is-freshwater-fish",args:["?x"],degVar:"?d1"},{pred:"is-domestic",args:["?x"],degVar:"?d2"}],"goldfish"),e("pig-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-domestic",args:["?x"],degVar:"?d2"},{pred:"is-omnivore",args:["?x"],degVar:"?d3"},{pred:"has-snout",args:["?x"],degVar:"?d4"}],"pig"),e("bengal-tiger-rule",[{pred:"species",args:["?x","tiger"],degVar:"?d1"},{pred:"lives-in-jungle",args:["?x"],degVar:"?d2"}],"bengal-tiger",35),e("siberian-tiger-rule",[{pred:"species",args:["?x","tiger"],degVar:"?d1"},{pred:"lives-in-tundra",args:["?x"],degVar:"?d2"}],"siberian-tiger",35),e("emperor-penguin-rule",[{pred:"species",args:["?x","penguin"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"}],"emperor-penguin",35),e("rockhopper-penguin-rule",[{pred:"species",args:["?x","penguin"],degVar:"?d1"},{pred:"is-small",args:["?x"],degVar:"?d2"},{pred:"has-crest",args:["?x"],degVar:"?d3"}],"rockhopper-penguin",35),e("king-cobra-rule",[{pred:"species",args:["?x","cobra"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"}],"king-cobra",35),e("green-tree-python-rule",[{pred:"species",args:["?x","python"],degVar:"?d1"},{pred:"climbs-trees",args:["?x"],degVar:"?d2"}],"green-tree-python",35),e("barn-owl-rule",[{pred:"species",args:["?x","owl"],degVar:"?d1"},{pred:"lives-near-humans",args:["?x"],degVar:"?d2"}],"barn-owl",35),e("snowy-owl-rule",[{pred:"species",args:["?x","owl"],degVar:"?d1"},{pred:"lives-in-arctic",args:["?x"],degVar:"?d2"}],"snowy-owl",35),e("grey-wolf-rule",[{pred:"species",args:["?x","wolf"],degVar:"?d1"},{pred:"lives-in-tundra",args:["?x"],degVar:"?d2"}],"grey-wolf",35),e("red-wolf-rule",[{pred:"species",args:["?x","wolf"],degVar:"?d1"},{pred:"is-endangered",args:["?x"],degVar:"?d2"}],"red-wolf",35),e("african-grey-parrot-rule",[{pred:"species",args:["?x","parrot"],degVar:"?d1"},{pred:"is-grey",args:["?x"],degVar:"?d2"}],"african-grey-parrot",35),e("blue-ringed-octopus-rule",[{pred:"species",args:["?x","octopus"],degVar:"?d1"},{pred:"is-venomous",args:["?x"],degVar:"?d2"}],"blue-ringed-octopus",35),e("indian-elephant-rule",[{pred:"species",args:["?x","elephant"],degVar:"?d1"},{pred:"is-domestic",args:["?x"],degVar:"?d2"}],"indian-elephant",35),e("peregrine-falcon-rule",[{pred:"species",args:["?x","falcon"],degVar:"?d1"},{pred:"is-fast",args:["?x"],degVar:"?d2"}],"peregrine-falcon",35),e("green-sea-turtle-rule",[{pred:"species",args:["?x","sea-turtle"],degVar:"?d1"},{pred:"is-herbivore",args:["?x"],degVar:"?d2"}],"green-sea-turtle",35),e("galapagos-tortoise-rule",[{pred:"species",args:["?x","tortoise"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"}],"galapagos-tortoise",35),e("bottlenose-dolphin-spinner-rule",[{pred:"species",args:["?x","dolphin"],degVar:"?d1"},{pred:"spins-when-jumping",args:["?x"],degVar:"?d2"}],"spinner-dolphin",35),e("albino-crocodile-rule",[{pred:"species",args:["?x","crocodile"],degVar:"?d1"},{pred:"is-albino",args:["?x"],degVar:"?d2"}],"albino-crocodile",35),e("golden-poison-frog-rule",[{pred:"species",args:["?x","poison-dart-frog"],degVar:"?d1"},{pred:"is-yellow",args:["?x"],degVar:"?d2"}],"golden-poison-frog",35),e("monarch-butterfly-rule",[{pred:"species",args:["?x","butterfly"],degVar:"?d1"},{pred:"migrates",args:["?x"],degVar:"?d2"}],"monarch-butterfly",35),e("atlas-moth-rule",[{pred:"species",args:["?x","moth"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"}],"atlas-moth",35),e("japanese-spider-crab-rule",[{pred:"species",args:["?x","crab"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"}],"japanese-spider-crab",35),o("scavenger-bird-rule",[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"is-scavenger",args:["?x"],degVar:"?d2"}],"is-scavenger-bird",50),o("burrowing-reptile-rule",[{pred:"is-reptile",args:["?x"],degVar:"?d1"},{pred:"burrows",args:["?x"],degVar:"?d2"}],"is-burrowing-reptile",50),o("climbing-mammal-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"climbs-trees",args:["?x"],degVar:"?d2"}],"is-climbing-mammal",50),o("gliding-mammal-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"glides",args:["?x"],degVar:"?d2"}],"is-gliding-mammal",50),o("arctic-bird-rule",[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"lives-in-arctic",args:["?x"],degVar:"?d2"}],"is-arctic-bird",50),o("desert-reptile-rule",[{pred:"is-reptile",args:["?x"],degVar:"?d1"},{pred:"lives-in-desert",args:["?x"],degVar:"?d2"}],"is-desert-reptile",50),o("island-species-rule",[{pred:"lives-on-island",args:["?x"],degVar:"?d1"},{pred:"is-endemic",args:["?x"],degVar:"?d2"}],"is-island-endemic",50),o("migratory-bird-rule",[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"migrates",args:["?x"],degVar:"?d2"}],"is-migratory-bird",50),o("hibernating-mammal-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"hibernates",args:["?x"],degVar:"?d2"}],"is-hibernating-mammal",50),o("aquatic-insect-rule",[{pred:"is-insect",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"}],"is-aquatic-insect",50),o("venomous-fish-rule",[{pred:"is-fish",args:["?x"],degVar:"?d1"},{pred:"is-venomous",args:["?x"],degVar:"?d2"}],"is-venomous-fish",50),o("nocturnal-bird-rule",[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"is-nocturnal",args:["?x"],degVar:"?d2"}],"is-nocturnal-bird",50),o("predatory-fish-rule",[{pred:"is-fish",args:["?x"],degVar:"?d1"},{pred:"is-carnivore",args:["?x"],degVar:"?d2"}],"is-predatory-fish",50),o("freshwater-crustacean-rule",[{pred:"is-crustacean",args:["?x"],degVar:"?d1"},{pred:"lives-in-freshwater",args:["?x"],degVar:"?d2"}],"is-freshwater-crustacean",50),e("dugong-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"},{pred:"is-herbivore",args:["?x"],degVar:"?d3"},{pred:"is-small",args:["?x"],degVar:"?d4"}],"dugong"),e("pangolin-variant-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"has-scales",args:["?x"],degVar:"?d2"},{pred:"is-nocturnal",args:["?x"],degVar:"?d3"}],"nocturnal-pangolin"),e("flying-lemur-rule",[{pred:"is-gliding-mammal",args:["?x"],degVar:"?d1"},{pred:"is-nocturnal",args:["?x"],degVar:"?d2"},{pred:"lives-in-tropics",args:["?x"],degVar:"?d3"}],"flying-lemur"),e("wild-boar-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-omnivore",args:["?x"],degVar:"?d2"},{pred:"has-tusks",args:["?x"],degVar:"?d3"}],"wild-boar"),e("warthog-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"has-tusks",args:["?x"],degVar:"?d2"},{pred:"lives-in-savanna",args:["?x"],degVar:"?d3"}],"warthog"),e("peccary-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-omnivore",args:["?x"],degVar:"?d2"},{pred:"lives-in-jungle",args:["?x"],degVar:"?d3"},{pred:"has-snout",args:["?x"],degVar:"?d4"}],"peccary"),e("numbat-rule",[{pred:"is-marsupial",args:["?x"],degVar:"?d1"},{pred:"eats-insects",args:["?x"],degVar:"?d2"},{pred:"has-stripes",args:["?x"],degVar:"?d3"}],"numbat"),e("quokka-rule",[{pred:"is-marsupial",args:["?x"],degVar:"?d1"},{pred:"is-small",args:["?x"],degVar:"?d2"},{pred:"lives-on-island",args:["?x"],degVar:"?d3"}],"quokka"),e("binturong-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-arboreal",args:["?x"],degVar:"?d2"},{pred:"has-prehensile-tail",args:["?x"],degVar:"?d3"}],"binturong"),e("coati-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-omnivore",args:["?x"],degVar:"?d2"},{pred:"has-long-snout",args:["?x"],degVar:"?d3"},{pred:"has-long-tail",args:["?x"],degVar:"?d4"}],"coati"),e("civet-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-nocturnal",args:["?x"],degVar:"?d2"},{pred:"is-arboreal",args:["?x"],degVar:"?d3"},{pred:"has-spots",args:["?x"],degVar:"?d4"}],"civet"),e("genet-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-nocturnal",args:["?x"],degVar:"?d2"},{pred:"has-spots",args:["?x"],degVar:"?d3"},{pred:"has-long-tail",args:["?x"],degVar:"?d4"}],"genet"),e("secretary-bird-rule",[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"is-carnivore",args:["?x"],degVar:"?d2"},{pred:"has-long-legs",args:["?x"],degVar:"?d3"},{pred:"lives-in-savanna",args:["?x"],degVar:"?d4"}],"secretary-bird"),e("shoebill-rule",[{pred:"is-wading-bird",args:["?x"],degVar:"?d1"},{pred:"has-large-beak",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],"shoebill"),e("hornbill-rule",[{pred:"is-tropical-bird",args:["?x"],degVar:"?d1"},{pred:"has-casque",args:["?x"],degVar:"?d2"}],"hornbill"),e("swift-rule",[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"is-fast",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"},{pred:"can-fly",args:["?x"],degVar:"?d4"}],"swift"),e("swallow-rule",[{pred:"is-migratory-bird",args:["?x"],degVar:"?d1"},{pred:"is-small",args:["?x"],degVar:"?d2"},{pred:"has-forked-tail",args:["?x"],degVar:"?d3"}],"swallow"),e("jay-rule",[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"has-bright-colors",args:["?x"],degVar:"?d2"},{pred:"is-loud",args:["?x"],degVar:"?d3"}],"jay"),e("magpie-rule",[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"has-black-white-pattern",args:["?x"],degVar:"?d2"},{pred:"collects-shiny-objects",args:["?x"],degVar:"?d3"}],"magpie"),e("cuckoo-rule",[{pred:"is-bird",args:["?x"],degVar:"?d1"},{pred:"is-parasitic",args:["?x"],degVar:"?d2"}],"cuckoo"),e("lyrebird-rule",[{pred:"is-songbird",args:["?x"],degVar:"?d1"},{pred:"mimics-sounds",args:["?x"],degVar:"?d2"}],"lyrebird"),e("wren-rule",[{pred:"is-songbird",args:["?x"],degVar:"?d1"},{pred:"is-small",args:["?x"],degVar:"?d2"},{pred:"has-upright-tail",args:["?x"],degVar:"?d3"}],"wren"),e("loon-rule",[{pred:"is-waterfowl",args:["?x"],degVar:"?d1"},{pred:"has-distinctive-call",args:["?x"],degVar:"?d2"}],"loon"),e("cormorant-rule",[{pred:"is-seabird",args:["?x"],degVar:"?d1"},{pred:"dives",args:["?x"],degVar:"?d2"}],"cormorant"),e("booby-rule",[{pred:"is-seabird",args:["?x"],degVar:"?d1"},{pred:"has-bright-feet",args:["?x"],degVar:"?d2"}],"booby"),e("frigatebird-rule",[{pred:"is-seabird",args:["?x"],degVar:"?d1"},{pred:"has-inflatable-pouch",args:["?x"],degVar:"?d2"}],"frigatebird"),e("arctic-tern-rule",[{pred:"is-arctic-bird",args:["?x"],degVar:"?d1"},{pred:"migrates",args:["?x"],degVar:"?d2"}],"arctic-tern"),e("snowy-egret-rule",[{pred:"is-wading-bird",args:["?x"],degVar:"?d1"},{pred:"is-white",args:["?x"],degVar:"?d2"}],"snowy-egret"),e("gila-monster-rule",[{pred:"is-desert-reptile",args:["?x"],degVar:"?d1"},{pred:"is-venomous",args:["?x"],degVar:"?d2"}],"gila-monster"),e("thorny-devil-rule",[{pred:"is-desert-reptile",args:["?x"],degVar:"?d1"},{pred:"has-spines",args:["?x"],degVar:"?d2"}],"thorny-devil"),e("frilled-lizard-rule",[{pred:"is-reptile",args:["?x"],degVar:"?d1"},{pred:"has-frill",args:["?x"],degVar:"?d2"}],"frilled-lizard"),e("tuatara-rule",[{pred:"is-reptile",args:["?x"],degVar:"?d1"},{pred:"is-island-endemic",args:["?x"],degVar:"?d2"},{pred:"has-third-eye",args:["?x"],degVar:"?d3"}],"tuatara"),e("marine-iguana-rule",[{pred:"is-marine-reptile",args:["?x"],degVar:"?d1"},{pred:"has-legs",args:["?x"],degVar:"?d2"},{pred:"is-herbivore",args:["?x"],degVar:"?d3"}],"marine-iguana"),e("moray-eel-rule",[{pred:"is-predatory-fish",args:["?x"],degVar:"?d1"},{pred:"lives-in-reef",args:["?x"],degVar:"?d2"},{pred:"has-elongated-body",args:["?x"],degVar:"?d3"}],"moray-eel"),e("grouper-rule",[{pred:"is-predatory-fish",args:["?x"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"},{pred:"lives-in-reef",args:["?x"],degVar:"?d3"}],"grouper"),e("sturgeon-rule",[{pred:"is-freshwater-fish",args:["?x"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"},{pred:"has-armor",args:["?x"],degVar:"?d3"}],"sturgeon"),e("carp-rule",[{pred:"is-freshwater-fish",args:["?x"],degVar:"?d1"},{pred:"is-herbivore",args:["?x"],degVar:"?d2"}],"carp"),e("bass-rule",[{pred:"is-freshwater-fish",args:["?x"],degVar:"?d1"},{pred:"is-carnivore",args:["?x"],degVar:"?d2"}],"bass"),e("marlin-rule",[{pred:"is-fish",args:["?x"],degVar:"?d1"},{pred:"has-sword-nose",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],"marlin"),e("remora-rule",[{pred:"is-fish",args:["?x"],degVar:"?d1"},{pred:"lives-symbiotically",args:["?x"],degVar:"?d2"},{pred:"has-suction-pad",args:["?x"],degVar:"?d3"}],"remora"),e("hornet-rule",[{pred:"is-flying-insect",args:["?x"],degVar:"?d1"},{pred:"has-stinger",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],"hornet"),e("leaf-cutter-ant-rule",[{pred:"is-social-insect",args:["?x"],degVar:"?d1"},{pred:"cuts-leaves",args:["?x"],degVar:"?d2"}],"leaf-cutter-ant"),e("army-ant-rule",[{pred:"is-social-insect",args:["?x"],degVar:"?d1"},{pred:"hunts-in-packs",args:["?x"],degVar:"?d2"}],"army-ant"),e("stag-beetle-rule",[{pred:"is-insect",args:["?x"],degVar:"?d1"},{pred:"has-large-mandibles",args:["?x"],degVar:"?d2"}],"stag-beetle"),e("water-strider-rule",[{pred:"is-aquatic-insect",args:["?x"],degVar:"?d1"},{pred:"walks-on-water",args:["?x"],degVar:"?d2"}],"water-strider"),e("diving-beetle-rule",[{pred:"is-aquatic-insect",args:["?x"],degVar:"?d1"},{pred:"is-carnivore",args:["?x"],degVar:"?d2"}],"diving-beetle"),e("atlas-beetle-rule",[{pred:"is-insect",args:["?x"],degVar:"?d1"},{pred:"has-horn",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],"atlas-beetle"),e("luna-moth-rule",[{pred:"is-flying-insect",args:["?x"],degVar:"?d1"},{pred:"is-nocturnal",args:["?x"],degVar:"?d2"},{pred:"has-long-tail",args:["?x"],degVar:"?d3"}],"luna-moth"),e("crayfish-rule",[{pred:"is-freshwater-crustacean",args:["?x"],degVar:"?d1"},{pred:"has-claws",args:["?x"],degVar:"?d2"}],"crayfish"),e("isopod-rule",[{pred:"is-crustacean",args:["?x"],degVar:"?d1"},{pred:"has-segments",args:["?x"],degVar:"?d2"},{pred:"lives-in-deep-sea",args:["?x"],degVar:"?d3"}],"giant-isopod"),e("sea-otter-rule",[{pred:"is-mammal",args:["?x"],degVar:"?d1"},{pred:"is-aquatic",args:["?x"],degVar:"?d2"},{pred:"uses-tools",args:["?x"],degVar:"?d3"},{pred:"lives-near-coast",args:["?x"],degVar:"?d4"}],"sea-otter"),e("sea-lion-steller-rule",[{pred:"is-pinniped",args:["?x"],degVar:"?d1"},{pred:"has-ear-flaps",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],"steller-sea-lion"),e("fire-salamander-rule",[{pred:"is-amphibian",args:["?x"],degVar:"?d1"},{pred:"has-tail",args:["?x"],degVar:"?d2"},{pred:"has-bright-colors",args:["?x"],degVar:"?d3"}],"fire-salamander"),e("hellbender-rule",[{pred:"is-aquatic-amphibian",args:["?x"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"}],"hellbender"),e("mudpuppy-rule",[{pred:"is-aquatic-amphibian",args:["?x"],degVar:"?d1"},{pred:"has-external-gills",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],"mudpuppy"),e("harvestman-rule",[{pred:"is-arachnid",args:["?x"],degVar:"?d1"},{pred:"has-long-legs",args:["?x"],degVar:"?d2"},{pred:"has-single-body-segment",args:["?x"],degVar:"?d3"}],"harvestman"),e("wolf-spider-rule",[{pred:"is-arachnid",args:["?x"],degVar:"?d1"},{pred:"hunts-on-ground",args:["?x"],degVar:"?d2"},{pred:"has-good-eyesight",args:["?x"],degVar:"?d3"}],"wolf-spider"),e("jumping-spider-rule",[{pred:"is-arachnid",args:["?x"],degVar:"?d1"},{pred:"can-jump",args:["?x"],degVar:"?d2"},{pred:"has-large-eyes",args:["?x"],degVar:"?d3"}],"jumping-spider"),e("king-cheetah-rule",[{pred:"species",args:["?x","cheetah"],degVar:"?d1"},{pred:"has-blotches",args:["?x"],degVar:"?d2"}],"king-cheetah",35),e("clouded-leopard-rule",[{pred:"species",args:["?x","leopard"],degVar:"?d1"},{pred:"is-small",args:["?x"],degVar:"?d2"}],"clouded-leopard",35),e("pygmy-seahorse-rule",[{pred:"species",args:["?x","seahorse"],degVar:"?d1"},{pred:"is-small",args:["?x"],degVar:"?d2"}],"pygmy-seahorse",35),e("nile-crocodile-rule",[{pred:"species",args:["?x","crocodile"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"}],"nile-crocodile",35),e("komodo-dragon-island-rule",[{pred:"species",args:["?x","komodo-dragon"],degVar:"?d1"},{pred:"is-island-endemic",args:["?x"],degVar:"?d2"}],"komodo-dragon-flores",35),e("blue-poison-dart-frog-rule",[{pred:"species",args:["?x","poison-dart-frog"],degVar:"?d1"},{pred:"is-blue",args:["?x"],degVar:"?d2"}],"blue-poison-dart-frog",35),e("black-mamba-rule",[{pred:"species",args:["?x","mamba"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"}],"black-mamba",35),e("green-mamba-rule",[{pred:"species",args:["?x","mamba"],degVar:"?d1"},{pred:"is-arboreal",args:["?x"],degVar:"?d2"}],"green-mamba",35),e("adelie-penguin-rule",[{pred:"species",args:["?x","penguin"],degVar:"?d1"},{pred:"lives-in-arctic",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],"adelie-penguin",35),e("indian-cobra-rule",[{pred:"species",args:["?x","cobra"],degVar:"?d1"},{pred:"lives-in-tropics",args:["?x"],degVar:"?d2"}],"indian-cobra",35),e("red-fox-rule",[{pred:"species",args:["?x","fox"],degVar:"?d1"},{pred:"has-red-fur",args:["?x"],degVar:"?d2"}],"red-fox",35),e("sawfish-rule",[{pred:"is-ray",args:["?x"],degVar:"?d1"},{pred:"has-saw-nose",args:["?x"],degVar:"?d2"}],"sawfish"),e("guitarfish-rule",[{pred:"is-ray",args:["?x"],degVar:"?d1"},{pred:"has-elongated-body",args:["?x"],degVar:"?d2"}],"guitarfish"),e("garden-eel-rule",[{pred:"is-fish",args:["?x"],degVar:"?d1"},{pred:"lives-in-colony",args:["?x"],degVar:"?d2"},{pred:"burrows",args:["?x"],degVar:"?d3"}],"garden-eel"),e("sunfish-rule",[{pred:"is-fish",args:["?x"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"},{pred:"has-flat-body",args:["?x"],degVar:"?d3"}],"ocean-sunfish"),e("oarfish-rule",[{pred:"is-deep-sea-fish",args:["?x"],degVar:"?d1"},{pred:"has-elongated-body",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],"oarfish"),e("hagfish-rule",[{pred:"is-deep-sea-fish",args:["?x"],degVar:"?d1"},{pred:"produces-slime",args:["?x"],degVar:"?d2"}],"hagfish"),e("lamprey-rule",[{pred:"is-fish",args:["?x"],degVar:"?d1"},{pred:"is-parasite",args:["?x"],degVar:"?d2"}],"lamprey"),e("arapaima-rule",[{pred:"is-freshwater-fish",args:["?x"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"},{pred:"lives-in-jungle",args:["?x"],degVar:"?d3"}],"arapaima"),e("triggerfish-rule",[{pred:"is-reef-fish",args:["?x"],degVar:"?d1"},{pred:"has-strong-jaws",args:["?x"],degVar:"?d2"}],"triggerfish"),e("wrasse-rule",[{pred:"is-reef-fish",args:["?x"],degVar:"?d1"},{pred:"is-cleaner",args:["?x"],degVar:"?d2"}],"cleaner-wrasse"),e("goby-rule",[{pred:"is-reef-fish",args:["?x"],degVar:"?d1"},{pred:"is-small",args:["?x"],degVar:"?d2"},{pred:"lives-symbiotically",args:["?x"],degVar:"?d3"}],"goby"),e("boxfish-rule",[{pred:"is-reef-fish",args:["?x"],degVar:"?d1"},{pred:"has-boxy-shape",args:["?x"],degVar:"?d2"}],"boxfish"),e("frogfish-rule",[{pred:"is-fish",args:["?x"],degVar:"?d1"},{pred:"uses-camouflage",args:["?x"],degVar:"?d2"},{pred:"has-lure",args:["?x"],degVar:"?d3"}],"frogfish"),e("abalone-rule",[{pred:"is-gastropod",args:["?x"],degVar:"?d1"},{pred:"lives-in-ocean",args:["?x"],degVar:"?d2"}],"abalone"),e("cone-snail-rule",[{pred:"is-gastropod",args:["?x"],degVar:"?d1"},{pred:"is-venomous",args:["?x"],degVar:"?d2"}],"cone-snail"),e("giant-clam-rule",[{pred:"is-bivalve",args:["?x"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"},{pred:"lives-in-reef",args:["?x"],degVar:"?d3"}],"giant-clam"),e("horseshoe-crab-rule",[{pred:"is-aquatic",args:["?x"],degVar:"?d1"},{pred:"has-exoskeleton",args:["?x"],degVar:"?d2"},{pred:"has-blue-blood",args:["?x"],degVar:"?d3"}],"horseshoe-crab"),e("planarian-rule",[{pred:"is-aquatic",args:["?x"],degVar:"?d1"},{pred:"regenerates",args:["?x"],degVar:"?d2"},{pred:"is-small",args:["?x"],degVar:"?d3"}],"planarian"),e("tardigrade-rule",[{pred:"has-eight-legs",args:["?x"],degVar:"?d1"},{pred:"is-microscopic",args:["?x"],degVar:"?d2"},{pred:"survives-extreme-conditions",args:["?x"],degVar:"?d3"}],"tardigrade"),e("nautilus-chambered-rule",[{pred:"is-cephalopod",args:["?x"],degVar:"?d1"},{pred:"has-external-shell",args:["?x"],degVar:"?d2"},{pred:"has-many-tentacles",args:["?x"],degVar:"?d3"}],"chambered-nautilus"),e("giant-pacific-octopus-rule",[{pred:"species",args:["?x","octopus"],degVar:"?d1"},{pred:"is-large",args:["?x"],degVar:"?d2"}],"giant-pacific-octopus",35),e("dumbo-octopus-rule",[{pred:"species",args:["?x","octopus"],degVar:"?d1"},{pred:"lives-in-deep-sea",args:["?x"],degVar:"?d2"}],"dumbo-octopus",35),e("colossal-squid-rule",[{pred:"species",args:["?x","squid"],degVar:"?d1"},{pred:"lives-in-deep-sea",args:["?x"],degVar:"?d2"},{pred:"is-large",args:["?x"],degVar:"?d3"}],"colossal-squid",35),e("snow-goose-rule",[{pred:"species",args:["?x","goose"],degVar:"?d1"},{pred:"is-white",args:["?x"],degVar:"?d2"}],"snow-goose",35),e("canada-goose-rule",[{pred:"species",args:["?x","goose"],degVar:"?d1"},{pred:"has-black-neck",args:["?x"],degVar:"?d2"}],"canada-goose",35)];function Te(g){return Math.round(g*20)/20}function Ve(g,r){let{traits:a}=ee(g),d=new Map;for(let s of r)d.set(s.pred,s);return[...a].sort().map(s=>{let t=d.get(s);return{pred:s,label:s,active:t?.active??!1,deg:t?.deg??Te(.65+Math.random()*.35)}})}function re(g,r){let a=r?.scaled??!1,d=a?[$,W,Y,he]:[$],i=[...d[0]],s=null,t=document.createElement("div");t.className="fuzzy-creature-wrap";let n=document.createElement("div");n.className="fuzzy-creature-controls",t.appendChild(n);let l=document.createElement("div");l.className="fuzzy-creature-canvas";let x=document.createElement("canvas");x.style.width="100%",x.style.display="block",l.appendChild(x),t.appendChild(l),g.appendChild(t),s=new q(x);function m(E){let v=new I;for(let w of E)w.active&&v.addFact({pred:w.pred,args:["creature"],deg:w.deg});for(let w of i)v.addRule(w);let T=v.run(),k=[];for(let w of T.facts.values())k.push(w);let R=x.getBoundingClientRect().width||500,y=U(k,i,R,{firedRules:T.firedRules});s&&(s.resize(),s.setLayout(y),s.draw())}let u=Ve(i,[]),h=new B({container:n,traits:u,onChange:E=>{m(E)},showRuleSlider:a,onRuleTierChange:a?E=>{let v=Math.max(0,Math.min(E,d.length-1));i=[...d[v]];let T=Ve(i,h.getTraits());h.setTraits(T),m(h.getTraits())}:void 0}),b=!0;new IntersectionObserver(E=>{for(let v of E)v.isIntersecting&&!b?(b=!0,s?.start()):!v.isIntersecting&&b&&(b=!1,s?.stop())},{threshold:.1}).observe(g),m(h.getTraits()),window.addEventListener("resize",()=>{m(h.getTraits())})}function fe(){let g=document.getElementById("fuzzy-fact-explorer");g&&ne(g);let r=document.getElementById("fuzzy-rule-demo");r&&ce(r);let a=document.getElementById("fuzzy-chain-demo");a&&xe(a);let d=document.getElementById("fuzzy-creature");d&&re(d);let i=document.getElementById("fuzzy-creature-scaled");i&&re(i,{scaled:!0})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",fe):fe();})();

Top comments (0)