# Path: intelligine/synergy/object/Food.py
# class Food(Resource):
# 
#     def __init__(self, collection, context):
#         super().__init__(collection, context)
#         context.metas.list.add(TYPE, self.get_id(), TYPE_RESOURCE_EXPLOITABLE)
# 
#     def get_what_carry(self):
#         return self  # dev
#         clone = self.__class__(self._collection, self._context)
#         self._collection.add_object(clone)
#         return clone
# 
#     def transform_to_stocked(self):
#         self._context.metas.list.remove(TYPE, self.get_id(), TYPE_RESOURCE_EXPLOITABLE)
#         self._context.metas.list.add(TYPE, self.get_id(), TYPE_RESOURCE_EATABLE)
#         self._add_col(COL_EATABLE)
#         self._add_col(COL_SMELL)
#         self._set_smell(SMELL_FOOD)
# 
# Path: intelligine/core/exceptions.py
# class CantFindWhereToPut(ActionException):
#     pass
# 
# Path: intelligine/cst.py
# MODE_EXPLO = IncrementedNamedInt.get('intelligine.basebug.move.explo')
# 
# TYPE_RESOURCE_EXPLOITABLE = IncrementedNamedInt.get('intelligine.object.type.resource.transformable')
# 
# MODE_NURSE = IncrementedNamedInt.get('intelligine.basebug.move.nurse')
# 
# TYPE_NURSERY = IncrementedNamedInt.get('intelligine.object.type.nursery')
# 
# MODE_HOME = IncrementedNamedInt.get('intelligine.basebug.move.home')
# 
# TYPE_RESOURCE_EATABLE = IncrementedNamedInt.get('intelligine.object.type.resource.eatable')
# 
# MODE_GOHOME = IncrementedNamedInt.get('intelligine.basebug.move.gohome')
# 
# CARRY = IncrementedNamedInt.get('intelligine.carry')
# 
# PUT_FAIL_COUNT = IncrementedNamedInt.get('intelligine.put.fail.count')
# 
# MODE_SEARCH_AROUND = IncrementedNamedInt.get('intelligine.basebug.move.search_around')
# 
# Path: intelligine/simulation/object/brain/part/transport/TransportBrainPart.py
# class TransportBrainPart(BrainPart):
# 
#     _mode_matches = {}
#     _types_matches = {}
# 
#     @classmethod
#     def _match_with_mode(cls, context, object_id, concerned_object_id):
#         move_mode = context.metas.value.get(MODE, object_id)
#         for takable_type in cls._mode_matches[move_mode]:
#             if context.metas.list.have(TYPE, concerned_object_id, takable_type, allow_empty=True):
#                 return True
#         return False
# 
#     @classmethod
#     def _objects_types_match(cls, context, object_a_id, object_b_id):
#         """
# 
#         Retourne vrai si un des type de l'objet b se trouve dans la lise de type définis dans _types_matches pour
#         l'un des types de l'objet a.
# 
#         :param context:
#         :param object_a_id:
#         :param object_b_id:
#         :return: bool
#         """
#         object_a_types = context.metas.list.get(TYPE, object_a_id)
#         object_b_types = context.metas.list.get(TYPE, object_b_id)
# 
#         for object_a_type in object_a_types:
#             if object_a_type in cls._types_matches:
#                 wanted_types = cls._types_matches[object_a_type]
#                 for object_b_type in object_b_types:
#                     if object_b_type in wanted_types:
#                         return True
# 
#         return False


from intelligine.synergy.object.Food import Food
from synergine.core.Core import Core
from intelligine.core.exceptions import CantFindWhereToPut
from intelligine.cst import MODE_EXPLO, TYPE_RESOURCE_EXPLOITABLE, MODE_NURSE, TYPE_NURSERY, \
    MODE_HOME, TYPE_RESOURCE_EATABLE, MODE_GOHOME, CARRY, PUT_FAIL_COUNT, MODE_SEARCH_AROUND
from intelligine.simulation.object.brain.part.transport.TransportBrainPart import TransportBrainPart
from synergine_xyz.cst import POSITION, POSITIONS


class AntPutBrainPart(TransportBrainPart):

    _mode_matches = TransportBrainPart._mode_matches.copy()
    _mode_matches.update({
        MODE_NURSE: [TYPE_NURSERY],
        MODE_HOME: [TYPE_RESOURCE_EATABLE],
        MODE_GOHOME: [],
        MODE_SEARCH_AROUND: []
    })

    _types_matches = {
        TYPE_RESOURCE_EXPLOITABLE: [TYPE_RESOURCE_EATABLE],

# Path: intelligine/synergy/object/Food.py
# class Food(Resource):
# 
#     def __init__(self, collection, context):
#         super().__init__(collection, context)
#         context.metas.list.add(TYPE, self.get_id(), TYPE_RESOURCE_EXPLOITABLE)
# 
#     def get_what_carry(self):
#         return self  # dev
#         clone = self.__class__(self._collection, self._context)
#         self._collection.add_object(clone)
#         return clone
# 
#     def transform_to_stocked(self):
#         self._context.metas.list.remove(TYPE, self.get_id(), TYPE_RESOURCE_EXPLOITABLE)
#         self._context.metas.list.add(TYPE, self.get_id(), TYPE_RESOURCE_EATABLE)
#         self._add_col(COL_EATABLE)
#         self._add_col(COL_SMELL)
#         self._set_smell(SMELL_FOOD)
# 
# Path: intelligine/core/exceptions.py
# class CantFindWhereToPut(ActionException):
#     pass
# 
# Path: intelligine/cst.py
# MODE_EXPLO = IncrementedNamedInt.get('intelligine.basebug.move.explo')
# 
# TYPE_RESOURCE_EXPLOITABLE = IncrementedNamedInt.get('intelligine.object.type.resource.transformable')
# 
# MODE_NURSE = IncrementedNamedInt.get('intelligine.basebug.move.nurse')
# 
# TYPE_NURSERY = IncrementedNamedInt.get('intelligine.object.type.nursery')
# 
# MODE_HOME = IncrementedNamedInt.get('intelligine.basebug.move.home')
# 
# TYPE_RESOURCE_EATABLE = IncrementedNamedInt.get('intelligine.object.type.resource.eatable')
# 
# MODE_GOHOME = IncrementedNamedInt.get('intelligine.basebug.move.gohome')
# 
# CARRY = IncrementedNamedInt.get('intelligine.carry')
# 
# PUT_FAIL_COUNT = IncrementedNamedInt.get('intelligine.put.fail.count')
# 
# MODE_SEARCH_AROUND = IncrementedNamedInt.get('intelligine.basebug.move.search_around')
# 
# Path: intelligine/simulation/object/brain/part/transport/TransportBrainPart.py
# class TransportBrainPart(BrainPart):
# 
#     _mode_matches = {}
#     _types_matches = {}
# 
#     @classmethod
#     def _match_with_mode(cls, context, object_id, concerned_object_id):
#         move_mode = context.metas.value.get(MODE, object_id)
#         for takable_type in cls._mode_matches[move_mode]:
#             if context.metas.list.have(TYPE, concerned_object_id, takable_type, allow_empty=True):
#                 return True
#         return False
# 
#     @classmethod
#     def _objects_types_match(cls, context, object_a_id, object_b_id):
#         """
# 
#         Retourne vrai si un des type de l'objet b se trouve dans la lise de type définis dans _types_matches pour
#         l'un des types de l'objet a.
# 
#         :param context:
#         :param object_a_id:
#         :param object_b_id:
#         :return: bool
#         """
#         object_a_types = context.metas.list.get(TYPE, object_a_id)
#         object_b_types = context.metas.list.get(TYPE, object_b_id)
# 
#         for object_a_type in object_a_types:
#             if object_a_type in cls._types_matches:
#                 wanted_types = cls._types_matches[object_a_type]
#                 for object_b_type in object_b_types:
#                     if object_b_type in wanted_types:
#                         return True
# 
#         return False


# Path: intelligine/simulation/object/brain/part/transport/AntPutBrainPart.py
from intelligine.synergy.object.Food import Food
from synergine.core.Core import Core
from intelligine.core.exceptions import CantFindWhereToPut
from intelligine.cst import MODE_EXPLO, TYPE_RESOURCE_EXPLOITABLE, MODE_NURSE, TYPE_NURSERY, \
    MODE_HOME, TYPE_RESOURCE_EATABLE, MODE_GOHOME, CARRY, PUT_FAIL_COUNT, MODE_SEARCH_AROUND
from intelligine.simulation.object.brain.part.transport.TransportBrainPart import TransportBrainPart
from synergine_xyz.cst import POSITION, POSITIONS



class AntPutBrainPart(TransportBrainPart):

    _mode_matches = TransportBrainPart._mode_matches.copy()
    _mode_matches.update({
        MODE_NURSE: [TYPE_NURSERY],
        MODE_HOME: [TYPE_RESOURCE_EATABLE],
        MODE_GOHOME: [],
        MODE_SEARCH_AROUND: []
    })

    _types_matches = {
        TYPE_RESOURCE_EXPLOITABLE: [TYPE_RESOURCE_EATABLE],

        TYPE_NURSERY: [TYPE_NURSERY]