Logic problem: need better logic for desired thruth table.

Grant Edwards invalid at invalid.invalid
Thu May 28 18:01:10 EDT 2015


On 2015-05-28, Skybuck Flying <skybuck2000 at 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...    

-- 
Grant Edwards               grant.b.edwards        Yow! Alright, you!!
                                  at               Imitate a WOUNDED SEAL
                              gmail.com            pleading for a PARKING
                                                   SPACE!!



More information about the Python-list mailing list