Play n Tools

Free tools & games for everyone

Free · No sign-up · No accounts

Decision table & rules lab

Write business rules as a decision table and find gaps, conflicts, unused and redundant rules; try cases, simplify the table and export test cases.

In a cell: - means any value, a / b means either, not a means anything but a. Lines starting with # are ignored.

    Try a case

    Simplified table

    Every combination

    How to use

    1. List the conditions your decision depends on, each with every value it can take: Member: yes, no. Split numbers into bands (under 50, 50 to 100, over 100).
    2. Write one rule per line: a cell for each condition in the same order, separated by |, then -> and what happens.
    3. Choose what happens when several rules match: only one may match, the first one wins, or all of them apply.
    4. Read the findings: gaps (cases no rule covers), conflicts (rules that disagree), rules that are never used and rules that are redundant.
    5. Try single cases, copy the simplified table, or save test cases as CSV for whoever builds or tests the system.

    Keyboard

    TabMove between boxes, lists and buttons; results update as you type
    Arrow keys in a listPick a value when trying a case

    Tips

    • A complete table has no gaps: every possible case gets an answer. Add a catch-all rule (all -) at the end of a first-wins table to be sure.
    • In a unique table, every case matches exactly one rule, so the order of rules does not matter and nothing hides another rule.
    • The sample has a gap on purpose: members ordering under 50 for delivery in the home country. Find it, then fix it.
    • “One test case per rule” gives the smallest set that makes every rule fire once; “every combination” tests it all.
    • Bands must not overlap in real life either: write “under 50” and “50 to 100”, not “up to 50” and “50 to 100”.

    About the lab

    The lab lists every combination of condition values (up to 200,000) and checks which rules match each one. A gap is a combination no rule matches. In a unique table, a combination matched by rules with different actions is a conflict. In a first-wins table, a rule that never wins any combination can never be used. A rule is redundant when every case it covers is also covered by another rule with the same action.

    The simplified table starts from the result of every combination and repeatedly joins two rows with the same action that differ in just one condition, so it gives the same answer for every covered case with fewer rows (not always the very fewest). Gaps are merged the same way so they read as short rules.

    The tests compare gaps, conflicts, unused and redundant rules with an independent Python check on random tables, and check that the simplified table gives the same result for every combination.

    See you tomorrow!

    A fresh daily puzzle every morning, and new tools added every month.

    Browse every product