Esempio n. 1
0
 def __init__(self):
     childSeq = b3.Sequence(
         [GetNextMove(),
          isNextMoveValidCondition(),
          ConsumeNextMove()])
     childList = [childSeq, b3.Succeeder()]
     super().__init__(childList)
Esempio n. 2
0
 def __init__(self):
     healOrBuyHeal = b3.Priority(
         [CheckPotionAndConsumeSEQ(),
          CheckBuyPotionGoBuySEQ()])
     childSeq = b3.Sequence([needsHealthCondition(), healOrBuyHeal])
     childList = [childSeq, b3.Succeeder()]
     super().__init__(childList)
Esempio n. 3
0
 def __init__(self):
     isFarFromGoal = b3.Inverter(isNextToGoalCondition())
     childSequence = b3.Sequence(
         [isFarFromGoal,
          WalkToGoalSEQ(),
          SetGoalToRessource()])
     childList = [childSequence, b3.Succeeder()]
     super().__init__(childList)
Esempio n. 4
0
 def __init__(self):
     isNotFull = b3.Inverter(isFullCondition())
     childSequence = b3.Sequence([
         isNotFull,
         isGoalLootCondition(),
         isNextToGoalCondition(),
         MineGoal()
     ])
     childList = [childSequence, b3.Succeeder()]
     super().__init__(childList)
Esempio n. 5
0
 def __init__(self):
     isThereNoPath = b3.Inverter(isThereAPathCondition())
     ifNoPathCreateIt = b3.Sequence([isThereNoPath, CreatePath()])
     childList = [ifNoPathCreateIt, b3.Succeeder()]
     super().__init__(childList)
Esempio n. 6
0
 def __init__(self):
     repeatTwiceAttack = b3.Repeater(AttackLastDirection(), 2)
     childSeq = b3.Sequence([wasStillCondition(), repeatTwiceAttack])
     childList = [childSeq, b3.Succeeder()]
     super().__init__(childList)
Esempio n. 7
0
 def __init__(self):
     isThereNoGoal = b3.Inverter(isThereAGoalCondition())
     childSequence = b3.Sequence([isThereNoGoal, SetGoalToRessource()])
     childList = [childSequence, b3.Succeeder()]
     super().__init__(childList)
Esempio n. 8
0
 def test_tick(self):
     node = b3.Succeeder()
     status = node._execute(TickStub())
     self.assertEqual(status, b3.SUCCESS)
Esempio n. 9
0
logfile = 'learnExp.csv'

#############################################################################

######  Set up tree

tr1 = b3.BehaviorTree()

if (test == "Dumb Selector"):  # argv = 1
    A = Rn3()
    B = Rn3()
    C = Rn3()
    # Vanilla selector node
    extinguish = b3.Priority([A, B, C])
    vict = Rn2()  # based on fixed P(s)
    save = b3.Succeeder()
    saver = b3.Priority([vict, save])
    changer = b3.Succeeder()
    tr1.root = b3.Sequence([saver, extinguish, changer])
    test_name = test
elif (test == "Smart Selector S1: P(s)"):  # argv = 2
    A = Rn3()
    B = Rn3()
    C = Rn3()
    # Vanilla selector node
    extinguish = SmrtSel01([A, B, C])
    vict = Rn2()  # based on fixed P(s)
    save = b3.Succeeder()
    saver = b3.Priority([vict, save])
    changer = b3.Succeeder()
    tr1.root = b3.Sequence([saver, extinguish, changer])