Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Clear&Readable solution in Clear category for [old] Boolean Algebra by SaintDron
"use strict";
const OPERATION_TABLE = {
conjunction: [[0, 0], [0, 1]],
disjunction: [[0, 1], [1, 1]],
implication: [[1, 1], [0, 1]],
exclusive: [[0, 1], [1, 0]],
equivalence: [[1, 0], [0, 1]],
};
const boolean = (x, y, operation) => OPERATION_TABLE[operation][x][y];
var assert = require('assert');
if (!global.is_checking) {
assert.equal(boolean(1, 0, "conjunction"), 0)
assert.equal(boolean(1, 0, "disjunction"), 1)
assert.equal(boolean(1, 1, "implication"), 1)
assert.equal(boolean(0, 1, "exclusive"), 1)
assert.equal(boolean(0, 1, "equivalence"), 0)
console.log("Coding complete? Click 'Check' to review your tests and earn cool rewards!");
}
May 7, 2019