From ad1e961de62fd72e316fde4dfc89f6f3d72dcafc Mon Sep 17 00:00:00 2001 From: Martin Berg Alstad <600878@stud.hvl.no> Date: Sat, 21 Jan 2023 20:23:48 +0100 Subject: [PATCH] Users can use | as or, added info in how to and keywords --- src/truth-table.tsx | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/src/truth-table.tsx b/src/truth-table.tsx index ceb6959..569efee 100644 --- a/src/truth-table.tsx +++ b/src/truth-table.tsx @@ -67,7 +67,10 @@ const TruthTablePage: Component = () => { */ function onClick(e: { preventDefault: () => void; }): void { e.preventDefault(); // Stops the page from reloading onClick - const exp = getInputElement()?.value; + let exp = getInputElement()?.value; + + exp = exp.replaceAll("|", "/") + if (exp) { history.pushState(null, "", `?exp=${ encodeURIComponent(exp) }`); getFetchResult(exp).then(null); @@ -143,15 +146,34 @@ const TruthTablePage: Component = () => {
-

{ "truthTableHowTo" /*TODO*/ }

+

{ `Fill in a truth expression and it will be simplified for you as much as possible. + It will also genereate a truth table with all possible values. You can use a single letter, + word or multiple words without spacing for each atomic value. + If you do not want to simplify the expression, simply turn off the toggle. + Keywords for operators are defined below. Parentheses is also allowed` }

- <> -

not

-

and

-

or

-

implication

- + + + + + + + + + + + + + + + + + + + + +
Not:!
And:&
Or:|/
Implication:{ "->" }