Logic problem: need better logic for desired thruth table. (thruth table to logic/boolean operations generator sought/needed)

Skybuck Flying skybuck2000 at hotmail.com
Thu May 28 18:12:00 EDT 2015


Ok, problem solved for now, it seems:

I used video tutorial method and inverted it for the false case ;)

But anyway... I would not only need a "thruth table to logic/boolean 
operations converter" but also a "boolean operations optimizer" ;)

# loop has to run if:
# 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))



def TestLogic( BotWaitForCooldown, CooldownDetected ):
# return BotWaitForCooldown or ((not BotWaitForCooldown) and 
CooldownDetected) # this logic is flawed, please improve logic.
return (not ((not BotWaitForCooldown) and CooldownDetected))  # fixes it.

if TestLogic( False, False ) == True:
print "test 1 ok"
else:
print "test 1 failed"

if TestLogic( False, True ) == False:
print "test 2 ok"
else:
print "test 2 failed"

if TestLogic( True, False ) == True:
print "test 3 ok"
else:
print "test 3 failed"

if TestLogic( True, True ) == True:
print "test 4 ok"
else:
print "test 4 failed"

Bye,
  Skybuck. 




More information about the Python-list mailing list