Re: help with a logic algorithm

Liste des GroupesRevenir à l c 
Sujet : Re: help with a logic algorithm
De : thiago.adams (at) *nospam* gmail.com (Thiago Adams)
Groupes : comp.lang.c
Date : 03. Apr 2024, 02:09:00
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <2d1a0694-c700-47e9-b5f7-2136431e14e4@gmail.com>
References : 1 2
User-Agent : Mozilla Thunderbird
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..

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