Example #1
0
 def __init__(self,name,timeLine):
     EventNode.__init__(self, name, EventType.FeedEvent)
     self.timeLine = timeLine
    goal = random.sample(allItems, 3)
    # ADD 3 ITEMS TO YOUR INVENTORY
    physicalInventory = goal[1:]
    goal = goal[:1]
    # for i in range(1):
    #     randItem = random.choice(items)
    #     physicalInventory.append(randItem)
    #     items.remove(randItem)

    inventory = physicalInventory[:]
    for person in adversaries:
        if person.living:
            inventory.append(person.alive)
    playerDesires = goal
    root = EventNode([], playerDesires, [], "LAST", "NULL")
    # After making all adversaries human, add non human adversaries
    forest = Adversary("Forest")
    forest.addInteraction(
        Interaction("Chopped down a Tree", ["Wood", "Axe"], ["Axe"]))
    adversaries.append(forest)

    # Find branches
    root.expandChildren(adversaries, inventory)
    # prune branches that are
    root.verify(inventory)
    # Prune away branches that can't be completed with our inventory
    root.eliminateRedundant()
    # Eliminate branches that contain the same set of actions.
    arr = root.reversedList()
    if len(arr) < 3 or len(arr) > 5:
Example #3
0
 def __init__(self, name, type, tradingContext):
     super(ITradingBrain, self).__init__(name, tradingContext)
     EventNode.__init__(self, name, type)
     self.tradingContext.eventFlow.addNode(self)
     self.__timer = []
     self.__marketData = []