def __init__(self, rules_json, other_items, load_items, **kwargs):
        populate_kwargs(self, self.__class__.__properties, kwargs)
        super(CraftingGame, self).__init__(rules_json, **kwargs)

        # List of bad blocks we can't double generate on
        self.bad_blocks = [mi.Block, mi.ResourceFont, mi.CraftingContainer, mi.CraftingItem, mi.Switch, mi.Door]

        # Create subclass tree - which items inherit from which items
        self.hierarchy_tree = HierarchyTree(self.rules)

        # Create a dictionary of items and their types for each item that appears in our rules
        if other_items is None:
            self.item_dict = {}
        else:
            # We might want to add distractor items that do not appear in the rules
            self.item_dict = other_items.copy()
        self.update_item_dict() # Goes through rules and updates item dict

        # Creates a graph of items and rules that lets us decide item placements
        self.crafting_graph = CraftingGraph(self.rules, self.item_dict, self.max_craft_depth)

        # Check for rule conflicts
        Rule.check_rules_valid(self.rules)

        self.load_items = load_items
Exemple #2
0
    def __init__(self, **kwargs):
        mazeutils.populate_kwargs(self, self.__class__.__properties, kwargs)
        super(Agent, self).__init__(**kwargs)

        self.actions = {'pass': self._pass}
        self.PRIO = 100
        self._all_agents = [
            x[1] for x in mazeutils.all_classes_of(sys.modules[__name__])
        ]
Exemple #3
0
 def __init__(self, **kwargs):
     '''
     kwargs:
         featurizer: featurizer to use when doing observe()
         map_size: (x_min, x_max, y_min, y_max), draw uniformly and randomly
     '''
     mazeutils.populate_kwargs(self, self.__class__.__properties, kwargs)
     super(BaseMazeGame, self).__init__()
     self.game_name = uuid.uuid4().hex
     self.__all_possible_features = None
     self.__reward = 0
 def __init__(self, **kwargs):
     populate_kwargs(self, self.__class__.__properties, kwargs)
     super(MultiGoals, self).__init__(**kwargs)
 def __init__(self, **kwargs):
     populate_kwargs(self, self.__class__.__properties, kwargs)
     super(GotoHidden, self).__init__(**kwargs)
 def __init__(self, **kwargs):
     populate_kwargs(self, self.__class__.__properties, kwargs)
     super(Exclusion, self).__init__(**kwargs)
 def __init__(self, **kwargs):
     populate_kwargs(self, self.__class__.__properties, kwargs)
     super(LightKey, self).__init__(**kwargs)
    def __init__(self, **kwargs):
        populate_kwargs(self, self.__class__.__properties, kwargs)

        self.game = None
        self.PRIO = 0
Exemple #9
0
 def __init__(self, **kwargs):
     mazeutils.populate_kwargs(self, self.__class__.__properties, kwargs)
     super(RewardOnEndMixin, self).__init__(**kwargs)
Exemple #10
0
 def __init__(self, **kwargs):
     mazeutils.populate_kwargs(self, self.__class__.__properties, kwargs)
     super(WithWaterAndBlocksMixin, self).__init__(**kwargs)