TMUniversal / LogicTableSolver

Solve Logic Tables with custom sizes and claims

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Logic Table Solver

License: MPL--2.0

Solve Logic Tables with custom sizes and claims

Install

Requires Node.JS Version >= 10

yarn install

Usage

Edit src/index.ts to fit your use case:

size determines the amount of people (A, B, C...) to take into account.

claims is an array of functions that return either true or false when given the values of a generated logic input table.

Claims

Claims must be a function that accepts boolean inputs in alphabetical order

(a, b, c, d, e, f...) => boolean

To include only b and d, a and c must still be included, but can be marked unused with a _ (underscore).

(_a, b, _c, d) => boolean

A claim should begin with an

eq(letter, ...)

operand, showing that (i.e.) A claims something.

Examples

Example 1: A claims B is lying

(a, b) => eq(a, not(b))

is equivalent to: A ⇔ ¬B

Example 2: C claims A and B are lying

(a, b, c) => eq(c, and(not(a), not(b)))

C ⇔ (¬A ∧ ¬B)

Running the script

Build before you run:

yarn run build
yarn run start

Author

👤 TMUniversal

📝 License

Copyright © 2021 TMUniversal.
This project is MPL-2.0 licensed.

About

Solve Logic Tables with custom sizes and claims

License:Mozilla Public License 2.0


Languages

Language:TypeScript 98.0%Language:JavaScript 2.0%