# Path: intelligine/cst.py
# POINTS_SMELL = IncrementedNamedInt.get('intelligine.points_smell')
# 
# MOLECULES = IncrementedNamedInt.get('intelligine.molecules')
# 
# MOLECULES_DIRECTION = IncrementedNamedInt.get('intelligine.mol.direction')
# 
# Path: intelligine/core/exceptions.py
# class NoMolecule(MoleculeException):
#     pass
# 
# Path: intelligine/synergy/event/move/direction.py
# def get_direction_for_degrees(degrees):
#     if degrees < 0:
#         degrees = 360 - abs(degrees)
#     for plage in directions_degrees:
#         if plage[0] <= degrees <= plage[1]:
#             return directions_degrees[plage]
#     raise Exception("Unknow plage for degree \"" + str(degrees) + '"')


from intelligine.cst import POINTS_SMELL, MOLECULES, MOLECULES_DIRECTION
from intelligine.core.exceptions import NoMolecule
from random import shuffle
from synergine_xyz.geometry import get_degree_from_north
from intelligine.synergy.event.move.direction import get_direction_for_degrees


class DirectionMolecule():

    WAY_UP = 'u'
    WAY_DOWN = 'd'

    _positions_key = None

    @classmethod
    def appose(cls, context, point, molecule):
        context.molecules().increment_with_molecule(point, molecule, context.get_cycle())

# Path: intelligine/cst.py
# POINTS_SMELL = IncrementedNamedInt.get('intelligine.points_smell')
# 
# MOLECULES = IncrementedNamedInt.get('intelligine.molecules')
# 
# MOLECULES_DIRECTION = IncrementedNamedInt.get('intelligine.mol.direction')
# 
# Path: intelligine/core/exceptions.py
# class NoMolecule(MoleculeException):
#     pass
# 
# Path: intelligine/synergy/event/move/direction.py
# def get_direction_for_degrees(degrees):
#     if degrees < 0:
#         degrees = 360 - abs(degrees)
#     for plage in directions_degrees:
#         if plage[0] <= degrees <= plage[1]:
#             return directions_degrees[plage]
#     raise Exception("Unknow plage for degree \"" + str(degrees) + '"')


# Path: intelligine/simulation/molecule/DirectionMolecule.py
from intelligine.cst import POINTS_SMELL, MOLECULES, MOLECULES_DIRECTION
from intelligine.core.exceptions import NoMolecule
from random import shuffle
from synergine_xyz.geometry import get_degree_from_north
from intelligine.synergy.event.move.direction import get_direction_for_degrees



class DirectionMolecule():

    WAY_UP = 'u'
    WAY_DOWN = 'd'

    _positions_key = None

    @classmethod
    def appose(cls, context, point, molecule):
        context.molecules().increment_with_molecule(point, molecule, context.get_cycle())

        context.metas.list.add(MOLECULES, MOLECULES, point, assert_not_in=False)