Boolean Algebra

Boolean Algebra

Simple
DE EL EN Español FR IT JA RU UK

En matemáticas y lógica matemática, el algebra booleana es una parte del algebra en la cual los valores de las variables son verdadero o falso, comunmente denotados con 1 o 0 respectivamente. En vez del algebra elemental dónde los valores de las variables son números y las operaciones principales son adición y multiplicación, las operaciones principales del algebra booleana son la conjunción (denotado ∧), la disyunción (denotado ∨) y la negación (denotado ¬).

En esta misión debes implementar algunas operaciones booleanas:
- "conjunction" (conjunción) denotado x ∧ y, satisface x ∧ y = 1 si x = y = 1 y x ∧ y = 0 si no.
- "disjunction" (disyunción) denotado x ∨ y, satisface x ∨ y = 0 si x = y = 0 y x ∨ y = 1 si no.
- "implication" (implicación material) denotado x→y y puede ser descrito como ¬ x ∨ y. Si x es verdadera entonces el valor de x → y se toma como el de y. Pero si x es falso entonces el valor de y puede ser ignorado; sin embargo la operación debe retornar algún valor de verdad t sólo hay dos opciones. entonces el valor de retorno es el que implica menos, es decir, verdadera.
- "exclusive" (o exclusivo) denotado x ⊕ y y puede ser descrito como (x ∨ y)∧ ¬ (x ∧ y). Excluye la posibilidad de ambos x y y. Definido en términos aritméticos es la adición módulo 2 dónde 1 + 1 = 0.
- "equivalence" (equivalencia) denotado x ≡ y y puede ser descrito como ¬ (x ⊕ y). Es verdadero sólo cuándo x y y tienen el mismo valor.

Ésta es la taabla de verdad para esas operaciones:

 x | y | x∧y | x∨y | x→y | x⊕y | x≡y |
--------------------------------------
 0 | 0 |  0  |  0  |  1  |  0  |  1  |
 1 | 0 |  0  |  1  |  0  |  1  |  0  |
 0 | 1 |  0  |  1  |  1  |  1  |  0  |
 1 | 1 |  1  |  1  |  1  |  0  |  1  |
--------------------------------------

Se te dan dos valores booleanos x y y como 1 o 0 y se te da un nombre de operación como fue descrito anteriormente. Debes calcular el valor y retornarlo como 1 o 0.

Entrada: Tres argumentos. X y Y como 0 o 1. Un nombre de operación como una cadena de carácteres.

Salida: El resultado 1 o 0.

Ejemplo:

assert.strictEqual(boolean(0, 0, "conjunction"), 0);
assert.strictEqual(boolean(0,...
You should be an authorized user in order to see the full description and start solving this mission.
19
Settings
Code:
Other:
Invalid hot key. Each hot key should be unique and valid
Hot keys:
CheckiO Extensions

CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.

In order to install CheckiO client you'll need installed Python (version at least 3.8)

Install CheckiO Client first:

pip3 install checkio_client

Configure your tool

checkio --domain=js config --key=

Sync solutions into your local folder

checkio sync

(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)

checkio serv -d

Alternatevly, you can install Chrome extension or FF addon

checkio install-plugin
checkio install-plugin --ff
checkio install-plugin --chromium

Read more here about other functionality that the checkio client provides. Feel free to submit an issue in case of any difficulties.

Pair Programming (Beta-version)

Welcome to Pair Programming! Engage in real-time collaboration on coding projects by starting a session and sharing the provided unique URL with friends or colleagues. This feature is perfect for joint project development, debugging, or learning new skills together. Simply click 'Start Session' to begin your collaborative coding journey!

Waiting for Pair Programming to start...

You are trying to join a pair programming session that has not started yet.

Please wait for the session creator to join.

Waiting for Pair Programming to reconnect...

It looks like the creator of the pair programming session closed the editor window.

It might happen accidentally, so that you can wait for reconnection.

×
 
 
<< <
> >>
exec show

Whats Next?

Free accounts will see Best CheckiO solutions with some delay.
Best Solutions will be opened in a moment
Become Awesome and Don't wait
The next stage is ""
Will be activated in
View More Solutions Random Review Solutions Go to the next mission