On 2015-05-28, Grant Edwards <invalid@invalid.invalid> wrote:
> On 2015-05-28, Skybuck Flying <skybuck2...@hotmail.com> wrote:
>
>> I tried logic below... but funny enough it failed, now I feel like a
>> noob lol and share this funny little fail logic with you.
>>
>> Can you improve/fix the logic ?
>
>> # while DesiredResult==True:
>> # Desired truth table for BotWaitForCooldown and CooldownDetected
>> # BotWaitForCooldown:  CooldownDetected: Desired Result:
>> # False                False             True
>> # False                True              False
>> # True                 False             True
>> # True                 True              True
>> # desired/suiting logic:
>> # (BotWaitForCooldown or ((not BotWaitForCooldown) and CooldownDetected))
>
> I don't see why you think that's the desired logic, since it doesn't
> match your truth table or your test.
>
>> def TestLogic( BotWaitForCooldown, CooldownDetected ):
>> return BotWaitForCooldown or ((not BotWaitForCooldown) and CooldownDetected)
>> # this logic is flawed, please improve logic.
>
> def TestLogic( BotWaitForCooldown, CooldownDetected ):
>     return not ((not BotWaitForCooldown) and CooldownDetected)
>
> works for me...    

While I think that's the most "obvious" solution and can be verified
by inspection: there's only out input state that is "false", so write an 
expression
for that one state and invert it.

However, you can apply De Morgan's law to simplify it:

       not ((not BotWaitForCooldown) and CooldownDetected)
       
is same as

       (BotWaitForCooldown or (not CooldownDetected))

-- 
Grant Edwards               grant.b.edwards        Yow! Do you have exactly
                                  at               what I want in a plaid
                              gmail.com            poindexter bar bat??
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to