Action planning

Each Controller determines its action for the next turn in function of its own memory, of its last actions, of the received Stimuli and Events and sometimes of randomness. It has only a limited time (THREAD_DURATION) to do it. If it doesn't respect this limit, we suppose it went into trouble and decide it does nothing next turn.

To quicken this part, we use several threads in parallel. We use X threads, so we group Controllers by X and the remaining will be treated at the end. For each group of Controllers, we link one Controller with each thread (passed as parameter), start the thread (it'll call the Controller method to determine next action).

The main loop thread will wait until the THREAD_DURATION or the end of all threads (we can use a periodic check). If some threads are not finished, we stop them, log the error and decide the Controller will do nothing next turn.