/* 
 * Thomas Pantzer: neuronal.h, v0.1b  23.9.97 22:29 
 * Thomas Pantzer: neuronal.h, v0.4.7  8.6.99 16:32 
 * 
 * 
 * Copyright 1997 by Thomas Pantzer
 * 
 * Permission to use, copy, modify, and distribute this software for noncommercial 
 * use and without fee is hereby granted, provided that the above copyright notice 
 * appear in all copies and that both that copyright notice and this permission 
 * notice appear in supporting documentation, and that the name of the Author not be 
 * used in advertising or publicity pertaining to distribution of the software 
 * without specific, written prior permission. The Author makes no representations about
 * the suitability of this software for any purpose.  It is provided "as is" 
 * without expressed or implied warranty. 
 * 
 * 
 * pantec@aix520.informatik.uni-leipzig.de   (Thomas Pantzer) 
 * 
 */


// Header for module Neuronal, generated by p2c 1.21alpha-07.Dec.93
#ifndef NEURONAL_H
#define NEURONAL_H





#ifndef KHEPERA_H
#include "khepera.h"
#endif

// kind of neurons
#define ROOT            (-1)

#define _INPUT_N         0
#define _OUTPUT_N        1
#define _HIDDEN_N        2
#define _SPECIAL_N	3

#define _SPEED_A         4
#define _GRIP_A          (_SPEED_A +2)

// BASIC sensors
#define DIST_SENSE      (_GRIP_A + 2)
#define LIGHT_SENSE     (DIST_SENSE + 8)
#define SPEED_SENSE     (LIGHT_SENSE + 8)
#define MOTION_SENSE    (SPEED_SENSE +2)
#define RLEN_SENSE      (MOTION_SENSE +2)

//GRIP sensors
#define ARM_POS         (RLEN_SENSE + 2)
#define GRIP_WIDTH      (ARM_POS + 1)
#define GRIP_CONTACT    (GRIP_WIDTH + 1)
#define GRIP_RESIST     (GRIP_CONTACT +1)

//CAMERA sensors
#define CAM_INTENSITY   (GRIP_RESIST +1)
#define CAM_DARK_POS    (CAM_INTENSITY +1)
#define CAM_LIGHT_POS   (CAM_DARK_POS +1)
#define CAM_PIXEL       (CAM_LIGHT_POS +1)

// this is last
#define MAX_SENSORS	(CAM_PIXEL + 64)




class t_Synapse {
public:
//  RobotContext *Robot;
  double Weight;
//  int kind;
  class t_Neuron *Axon;

  //organizing stuff
  int id;
  class t_Synapse *next;

  void Init(int);
  void Done(void);

  double ReadInput(int);
  void Cut(class t_Neuron *);
  
  virtual void Show(t_vector &);
};

class t_Neuron {
public:
  double Bias,act_val;
  int kind,time_stamp;
  t_Synapse *Synapse;

  //organizing stuff
  int id;
  t_vector pos;
  
  char type_name[256], unit_name[256];
  class t_Neuron *next;


  void Init(int, double, double, int, double);
  void Done(void);
  char InBox(int, int);
  class t_Neuron *GetNeuron(int);

  void Cut(class t_Neuron *);
  void Cut(class t_Synapse *);

//  void SetInputID(int);
//  void SetOutputID(int);
  
  void Connect(class t_Neuron *, double);
  char IsActive(void);
  
  virtual double Activation(int);
  virtual void WriteOutput(int stamp);
//  virtual double ReadInput(int stamp);
  virtual void Show(void);
};

//
//   t_Sensor = object(t_Synapse)
//                function ReadInput:double;      virtual;
//              end;
//


#endif /*NEURONAL_H*/

// End.







/**/
/**/
/**/
/**/
/**/
/**/
/**/
/**/
/*****  End Of File  ****************************/
