Re: help with a logic algorithm

Liste des GroupesRevenir à l c 
Sujet : Re: help with a logic algorithm
De : nospam (at) *nospam* please.ty (jak)
Groupes : comp.lang.c
Date : 03. Apr 2024, 04:25:10
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <uuiem8$3m2dr$1@dont-email.me>
References : 1 2 3
User-Agent : Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 SeaMonkey/2.53.18.2
Thiago Adams ha scritto:
Em 4/2/2024 6:23 PM, Scott Lurndal escreveu:
Thiago Adams <thiago.adams@gmail.com> writes:
I need an algorithm that finds the possible states of variables used in
"ifs"
>
for instance, I need to find out possible states:
>
if (a && b){
>
   // 'a' is true
   // 'b' is true
>
}
else
{
   // 'a' maybe be true or false
   // 'b' maybe be true or false
}
>
>
Create truth tables. Optionally use deMorgans
laws to simplify.
>
https://en.wikipedia.org/wiki/Boolean_algebra
https://en.wikipedia.org/wiki/De_Morgan%27s_laws
>
  This truth table is kind of "brutal force" isn't it?
But this gave me an idea.
 I can make a expression tree.
 Visiting the tree I will find a variable that I don't know if it is true or false.
Then I continue the evaluation considering this variable is true.
Then I continue the evaluation (from the point we did a branch) considering it is false.
At the end of evaluation I have the final result of the expression true and false I can merge all possible combinations for true and false.
I will try..
 
... or you could create a two-dimensional lookup-table or an algorithm
that represents a Karnaugh map. You can find some "Karnaugh map solver"
on the web.

Date Sujet#  Auteur
2 Apr 24 * help with a logic algorithm13Thiago Adams
3 Apr 24 +* Re: help with a logic algorithm3Thiago Adams
3 Apr 24 i+- Re: help with a logic algorithm1jak
3 Apr 24 i`- Re: help with a logic algorithm1Thiago Adams
3 Apr 24 +- Re: help with a logic algorithm1Janis Papanagnou
3 Apr 24 +* Re: help with a logic algorithm5Anton Shepelev
3 Apr 24 i+- Re: help with a logic algorithm1Thiago Adams
3 Apr 24 i`* Re: help with a logic algorithm3Thiago Adams
4 Apr 24 i `* Re: help with a logic algorithm2Paul
5 Apr 24 i  `- Re: help with a logic algorithm1Anton Shepelev
4 Apr 24 `* Re: help with a logic algorithm3jak
4 Apr 24  `* Re: help with a logic algorithm2Thiago Adams
7 Apr 24   `- Re: help with a logic algorithm1Anton Shepelev

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal