"""
Module that holds classes that represent agents.
"""

import abc
import pygame
import world
import interaction

class Agent(world.Entity):
    """
    Class that represents an agent.
    """

    color = (3, 124, 146, 255)
    interactions = []

    def __init__(self):
        super(Agent, self).__init__()

    def select_interaction(self):
        """
        Select an interaction to enact.

        :return: 
        """
        pass

    def enact_interaction(self, interaction):
        """
        :param interaction: The interaction to enact.
        :type interaction: Interaction
        """ 
        pass

    def set_primitives(self, primitives):
        self.primitives = primitives

    def set_motivation(self, motivation):
        self.motivation = motivation

    def collidable(self):
        return False

class ConstructiveAgent(Agent):
    """
    An agent with a fully recursive existence. It considers all experiment as 
    abstract and processes all experiments in the same way.
    """
    def enact_interaction(self, interaction):
        if isinstance(interaction, interaction.PrimitiveInteraction):
            pass
        else:
            pass
@@ -314,18 +314,43 @@
     
-def select
+@abc.abstractmethod%0A    def prepare
 _int
@@ -389,14 +389,15 @@
     
-Select
+Prepare
  an 
@@ -421,111 +421,525 @@
 act.
-%0A%0A        :return: %0A        %22%22%22%0A        pass%0A%0A    def enact_interaction(self, interaction):%0A        %22%22%22
+ %0A        %0A        Interaction enaction is split into two parts to better handle multiple%0A        agents. First, all agents prepare the interaction to enact without%0A        manipulating the world state, and afterwards all agents (in randomized %0A        order) enact that interaction. %0A        %0A        This ensures that an agent at any one point in time does not have%0A        access to world state information it should not yet know (especially %0A        when it becomes more complex with e.g. a visual subsystem). If 
 %0A   
@@ -947,118 +947,667 @@
     
-:
+pre
 para
-m interaction: The interaction to enact.%0A        :type interaction: Interaction%0A        %22%22%22 %0A        pass
+tion was immediately followed by enaction, an agent could%0A        potentially respond to the interaction of another agent made %22earlier%22%0A        at the same discrete point in time!%0A%0A        :return: Something that will be passed to enact_interaction of this%0A        agent.%0A        %22%22%22%0A        raise NotImplementedError(%22Should be implemented by child.%22)%0A%0A    @abc.abstractmethod%0A    def enact_interaction(self, data):%0A        %22%22%22%0A        Enact the interaction that was prepared.%0A%0A        :param data: The data that was returned by prepare_interaction this %0A        step.%0A        %22%22%22 %0A        raise NotImplementedError(%22Should be implemented by child.%22)
 %0A%0A  
@@ -1999,37 +1999,39 @@
     %22%22%22%0A    def 
-enact
+prepare
 _interaction(sel
@@ -2035,129 +2035,64 @@
 self
-, interaction):%0A        if isinstance(interaction, interaction.PrimitiveInteraction):%0A            pass%0A        else:%0A    
+):%0A        pass%0A%0A    def enact_interaction(self, data):%0A
     

Change agent API.