/*
 * Interface.java
 *
 * Created on 8 of February 2006, 2:04
 */
/**
 *
 * @author  Paulo Roque Silva
 */
import javax.swing.*;
import java.awt.*;
import java.util.Date;

public class Interface extends JPanel {
    
    public static final long    serialVersionUID = 2023L;
    // Vers�o do Interface
    static final int	MaxDisplay = 300; // Janela (passos)
	public static int   Ink;
	// ink cor 0=preto 1=vermelho 2=verde 3=azul 4=laranja
	public static int	[]Taste;
	public static int	[]Vision;
	public static int	[]Sound;
	public static int	[]Smell;
	public static int   Lovely;
	public static int   QF;
    public static boolean Warned; // Se em aviso
    public static boolean WarnSense[]; // Se avisado
	Brain	      		mind; // Daos do c�rebro
    boolean     		execute; // se em execu��o
    Color       		colorBefore;
    int         		i, n; // �ndexes
    long				ciclo;
    Image 				imge, imgeW;
    Image       		imgWorld, imgE, imgElegans2,
	imgElegans3, imgElegans4, imgElegans2n, imgElegans3n,
	imgElegans4n, imgElegans2w, imgElegans3w, imgElegans4w,
	imgElegans2e, imgElegans3e, imgElegans4e;
    int         		[]value = new int[100];
    // Mem�ria auxiliar
    
    /** Creates new form Interface */
    public Interface() {
    	int i;

        imge = Toolkit.getDefaultToolkit().
        		getImage("formicaLogo120pxl.jpg");
        imgeW = Toolkit.getDefaultToolkit().
        		getImage("World8x8.jpg");
        execute = false;
        ciclo = 0;
    	Ink = 0;
    	Taste = new int[Brain.NanalogTaste];
        for (i=0; i<Taste.length; i++)
        	Taste[i] = 0;
    	Vision = new int[Brain.NanalogVision];
        for (i=0; i<Vision.length; i++)
        	Vision[i] = 0;
    	Sound = new int[Brain.NanalogSound];
        for (i=0; i<Sound.length; i++)
        	Sound[i] = 0;
    	Smell = new int[Brain.NanalogSmell];
        for (i=0; i<Smell.length; i++)
        	Smell[i] = 0;
        Lovely = 0;
        QF = 0;
        WarnSense = new boolean[Brain.SENSES];
        for (i=0; i < Brain.SENSES; i++)
        	WarnSense[i] = false;
        
        Toolkit kit = Toolkit.getDefaultToolkit();
        imgWorld    = kit.getImage("World.jpg"); // Mundo
        imgElegans2 = kit.getImage("c_elegans2.jpg");
        imgElegans3 = kit.getImage("c_elegans3.jpg");
        imgElegans4 = kit.getImage("c_elegans4.jpg");
        imgElegans2n = kit.getImage("c_elegans2n.jpg");
        imgElegans3n = kit.getImage("c_elegans3n.jpg");
        imgElegans4n = kit.getImage("c_elegans4n.jpg");
        imgElegans2w = kit.getImage("c_elegans2w.jpg");
        imgElegans3w = kit.getImage("c_elegans3w.jpg");
        imgElegans4w = kit.getImage("c_elegans4w.jpg");
        imgElegans2e = kit.getImage("c_elegans2e.jpg");
        imgElegans3e = kit.getImage("c_elegans3e.jpg");
        imgElegans4e = kit.getImage("c_elegans4e.jpg");
        for (i=0; i<value.length; i++)
            value[i] = 0;
    }
    
    public void displayRobot(Brain m, boolean ex,
    		boolean w) {
        
    	mind = m;
        execute = ex;
    	Warned = w;
    }
    
    public void saveValue(int n, int val) {
        
        value[n] = val;
    }

    public void paintComponent(Graphics g) {
    	int n, m, rct, bom, aux,
    		inicioJanela,
    		fimJanela,
    		pointerJanela,
    		temp; // Define janela
   		float t=0;
   		Font fDefault, f;
       
        super.paintComponent(g);
        g.drawImage(imge, 450, 210, null, null);
    	if (Liberu.Robot == 0) {
            g.drawString("World", 785, 55);
            g.drawImage(imgeW, 720, 65, null, null);
    	}
        colorBefore = g.getColor();
        
        //#################################################

        if (Liberu.Robot == 0) {
            imgE = imgElegans2;
        	if (value[4] == World.NORTH)
        		imgE = imgElegans2n;
        	if (value[4] == World.WEST)
        		imgE = imgElegans2w;
        	if (value[4] == World.EAST)
        		imgE = imgElegans2e;
            if (value[0] == 61) {
            	imgE = imgElegans3;
            	if (value[4] == World.NORTH)
            		imgE = imgElegans3n;
            	if (value[4] == World.WEST)
            		imgE = imgElegans3w;
            	if (value[4] == World.EAST)
            		imgE = imgElegans3e;
            }
            if (value[0] == 7) {
            	imgE = imgElegans4;
            	if (value[4] == World.NORTH)
            		imgE = imgElegans4n;
            	if (value[4] == World.WEST)
            		imgE = imgElegans4w;
            	if (value[4] == World.EAST)
            		imgE = imgElegans4e;
            }
            if (value[0] != 0) g.drawImage(imgE,
            		735 + 60 * ((value[0]-1) % 8),
                             80 + 60 * ((value[0]-1) / 8),
                              null);
        }
        if (Liberu.Robot == 0) {
            switch (value[2]) {               								// value 2         Elegans
            case World.EARTH: g.drawString(
            		"Earth", 150, 230);
                break;
            case World.WATER: g.drawString(
            		"Water", 150, 230);
                break;
            case World.FOOD: g.drawString(
            		"Home", 150, 230);
                break;
            default: g.drawString("Error", 150, 230);
                break;
            }
        	if (Liberu.Robot == 0) {
                g.drawString("Orientation= ", 40, 405);
                switch (value[4]) {               								// value 4
                case World.NORTH: g.drawString(
                		"North", 150, 405);
                    break;
                case World.EAST: g.drawString(
                		"East", 150, 405);
                    break;
                case World.SOUTH: g.drawString(
                		"South", 150, 405);
                    break;
                case World.WEST: g.drawString(
                		"West", 150, 405);
                    break;
                default: g.drawString("Error", 150, 405);
                    break;
                }
        	}
        }
    //#####################################################

        if (Cortex.Warn && Warned) {
            g.setColor(Color.RED);
            for (n=0; n < Brain.SENSES; n++) {
            	if (Remember.NewSense[n])
            		if (!WarnSense[n])
                    	WarnSense[n] =
                    	Remember.NewSense[n];
            }
        }
        for (n=0; n < Brain.SENSES; n++)
        	if (WarnSense[n])
        		switch (n) {
        		case Brain.Taste: {
                    g.drawString("WARNING - New event!" +
        		" TASTE", 600, 585 + 0 * 30);
                    break;
        		}
        		case Brain.Vision: {
                    g.drawString("WARNING - New event!" +
        		" VISION", 600, 585 + 1 * 30);
                    break;
        		}
        		case Brain.Tact: {
                    g.drawString("WARNING - New event!" +
        		" TACT", 600, 585 + 2 * 30);
                    break;
        		}
        		case Brain.Sound: {
                    g.drawString("WARNING - New event!" +
        		" SOUND", 600, 585 + 3 * 30);
                    break;
        		}
        		case Brain.Smell: {
                    g.drawString("WARNING - New event!" +
        		" SMELL", 600, 585 + 4 * 30);
                    break;
        		}
        		case Brain.ProSelf: {
                    g.drawString("WARNING - New event!" +
        		" SELF", 600, 585 + 5 * 30);
                    break;
        		}
        		default:
                    g.drawString("ERROR case...", 600,
                    		585 + 6 * 30);
        		}
    	g.setColor(colorBefore);
        
        g.drawString("Step= ", 40, 20);
        g.drawString(Integer.toString(mind.past.actual),
        		150, 20);
        if (mind.past.actual <= Emotions.ActRandom) {
            g.setColor(Color.RED);
            g.drawString("Womb", 200, 20);
        	g.setColor(colorBefore);
        }

        g.drawString("Time(s)= ", 40, 55);
    	t = (float)mind.past.timeLifeReal/1000/60/60;
    	// t em horas
        g.drawString("hr", 150, 55);
        g.drawString(Long.toString((long)Math.floor(t)),
        		130, 55);
    	t = (float)(t - (int)Math.floor(t));
    	// t = resto em horas
        g.drawString("min", 230, 55);
        t = t * 60; // t em minutos
        g.drawString(Long.toString((long)Math.floor(t)),
        		210, 55);
        g.drawString("s", 310, 55);
        t = (float)(t - (int)Math.floor(t));
        // t = resto em minutos
        g.drawString(Long.toString((long)Math.floor(t*60)),
        		290, 55); // t em segundos
    
        g.drawString("Percentage (Lovely/Neurons)= ",
        		40, 90);
        if (Liberu.Already)
            g.drawString(Integer.toString(
            		(int)(Lovely/(Brain.SENSES*
            				(float)mind.past.nNeuronsTime)*
            				100)), 230, 90);

        g.drawString("Born: ", 40, 125);
        if (!execute)
            g.drawString((new Date()).toString() ,
            		140, 125);
        else
            g.drawString((new Date(
            		mind.past.bornTime).toString()) ,
            		140, 125);
        
        g.drawString("Cycle(ms): ", 40, 160);
        if (execute)
        	ciclo = mind.past.getCicle();
        g.drawString(Long.toString(ciclo) , 200, 160);
        //  ###############################################
        if (execute) {
            g.drawString("Remember" , 250, 195);
            g.drawString("Real" , 150, 195);
        }
        // TASTE
        if (Liberu.Already)
        	if (Remember.NewSense[0])
                g.setColor(Color.BLUE);
        g.drawString("Taste  = ", 40, 230);
    	if (Liberu.Robot == 1 || Liberu.Robot == 2)
            g.drawString(Integer.toString(Taste[0]),
            		150, 230);
    	aux = 0;
    	if (Liberu.Robot == 0)
        	aux = Brain.NanalogTaste;
        if (Liberu.Robot == 1)
        	aux = Brain.NanalogTasteR;
        if (Liberu.Robot == 2)
        	aux = Brain.NanalogTasteN;
        if (execute)
            for (n=0; n < aux; n++)
            	if ((int)mind.past.time[Math.abs(
            			Emotions.Good)][Brain.Taste].
            			getPerception(n).recPower >
            	Brain.MinSense) {
                    if (Liberu.Robot == 0)
                        switch (n+1) {               								// value 2         Elegans
                        case World.EARTH: g.drawString(
                        		"Earth", 250, 230);
                            break;
                        case World.WATER: g.drawString(
                        		"Water", 250, 230);
                            break;
                        case World.FOOD: g.drawString(
                        		"Home", 250, 230);
                            break;
                        default: g.drawString("Error",
                        		250, 230);
                            break;
                        }
                    if (Liberu.Robot == 1 ||
                    		Liberu.Robot == 2)
                    	g.drawString(Integer.toString(
                    		(int)mind.past.time[Math.abs(
                    		Emotions.Good)][Brain.Taste].
                    		getPerception(n).recPower),
                    			250, 230);
            	}
        g.setColor(colorBefore);
        // VISION
        if (Liberu.Already)
            if (Remember.NewSense[1])
                g.setColor(Color.BLUE);
        g.drawString("Vision  = ", 40, 265);
        if (Liberu.Robot == 0)
            Vision[1] = value[5];
        if (Liberu.Robot == 0)
        	aux = Brain.NanalogVision;
        if (Liberu.Robot == 1)
        	aux = Brain.NanalogVisionR;
        if (Liberu.Robot == 2)
        	aux = Brain.NanalogVisionN;
        if (Vision[1] == World.WALL)               						// value 5         Elegans
            g.drawString("Wall", 150, 265);												// Elegans
        else																			// Elegans
        	for (n=0; n < aux; n++) {
                g.drawString(Integer.toString(Vision[n]),
                		150+n*35, 265);
                if (execute)
                    g.drawString(Integer.toString(
                    	(int)mind.past.time[Math.abs(
                    		Emotions.Good)][Brain.Vision].
                    	getPerception(n).recPower),
                    		250+n*35, 265);
        	}
        g.setColor(colorBefore);
        // TACT
        if (Liberu.Already)
            if (Remember.NewSense[2])
                g.setColor(Color.BLUE);
        g.drawString("Tact     = ", 40, 300);
        if (Liberu.Robot == 1 || Liberu.Robot == 2)
        	value[1] = Mind.Tact[0];
        if (value[1] == Brain.TACT)
        	g.drawString("Obstacle", 150, 300);
        else
            g.drawString("        ", 150, 300);
        if (Liberu.Already && execute)
            if (mind.past.time[Math.abs(Emotions.Good)]
            		[Brain.Tact].getPerception(0).
            		recPower > Mind.Power/2)
            	g.drawString("Obstacle", 250, 300);
            else
                g.drawString("        ", 250, 300);
        if (Liberu.Robot == 0) {
            g.drawString(Integer.toString(value[3]),
            		220, 300);
            if (Liberu.Already && execute)
                g.drawString(Integer.toString((int)
                		mind.past.time[Math.abs(
                				Emotions.Good)]
                		[Brain.Tact].getPerception(1).
                		recPower), 320,300);
        }
        g.setColor(colorBefore);
        // SOUND
        if (Liberu.Already)
            if (Remember.NewSense[3])
                g.setColor(Color.BLUE);
        g.drawString("Sound  = ", 40, 335);
        if (Liberu.Robot == 0)
        	aux = Brain.NanalogSound;
        if (Liberu.Robot == 1)
        	aux = Brain.NanalogSoundR;
        if (Liberu.Robot == 2)
        	aux = Brain.NanalogSoundN;
        for (n=0; n < aux; n++) {
            if (Liberu.Robot == 1 || Liberu.Robot == 2)
            	value[36+n] = Sound[n];
            g.drawString(Integer.toString(value[36+n]),
            		150+n*30, 335);
        }
        temp = 0;
        if (execute) {
            temp = 0;
            for (n=0; n < aux; n++)
            	temp += (int)mind.past.time[Math.abs(
            			Emotions.Good)][Brain.Sound].
            	getPerception(n).recPower;
            temp = (int)(temp / aux);
            g.drawString(Integer.toString(temp), 350, 335);
        }
        g.setColor(colorBefore);
        // OLFACT
        if (Liberu.Already)
            if (Remember.NewSense[4])
                g.setColor(Color.BLUE);
        g.drawString("Smell  = ", 40, 370);
        if (Liberu.Robot == 0)
        	aux = Brain.NanalogSmell;
        if (Liberu.Robot == 1)
        	aux = Brain.NanalogSmellR;
        if (Liberu.Robot == 2)
        	aux = Brain.NanalogSmellN;
        if (Liberu.Robot == 1 || Liberu.Robot == 2)
            for (n=0; n < aux; n++) {
            	value[n] = Smell[n];
                g.drawString(Integer.toString(value[n]),
                		150+n*35, 370);
                if (execute)
                    g.drawString(Integer.toString(
                    	(int)mind.past.time[Math.abs(
                    		Emotions.Good)][Brain.Smell].
                    	getPerception(n).recPower),
                    		250+n*35, 370);
            }
        if (Liberu.Robot == 0)
            g.drawString(Integer.toString(value[0]),
            		150, 370);
        if (execute && Liberu.Robot == 0)
            for (n=0; n < aux; n++) {
                if ((int)mind.past.time[Math.abs(
                		Emotions.Good)][Brain.Smell].
                		getPerception(n).recPower >
                Brain.MinSense)
                    g.drawString(Integer.toString(n+1),
                    		250, 370);
            }
        g.setColor(colorBefore);

        if (Liberu.Already && execute)
        	for (i=0; i<mind.past.time[Math.abs(
        			Emotions.Good)][Brain.ProSelf].
        			perception.size(); i++)
            	if (mind.past.time[Math.abs(Emotions.Good)]
            			[Brain.ProSelf].getPerception(i).
            			recPower > Brain.MinSense)
            		switch (i) {
                	case Brain.DRINK:
                    	g.drawString("Drink", 250, 405);
                    	break;
                	case Brain.EAT:
                    	g.drawString("Eat", 250, 405);
                    	break;
                	case Brain.WALK:
                    	g.drawString("Walk", 250, 405);
                    	break;
                	case Brain.TURN_LEFT:
                    	g.drawString("Left", 250, 405);
                    	break;
                	case Brain.TURN_RIGHT:
                    	g.drawString("Right", 250, 405);
                    	break;
                	default:
                	}
        g.drawString("Energy = ", 450, 90);
        if (Brain.Energy) {
            g.setColor(Color.BLUE);
            g.drawString("Need", 560, 90);
        	g.setColor(colorBefore);
        }
        else
            g.drawString("No need", 560, 90);
        
        g.drawString("Happy = ", 450, 125);
        if (QF >= 0) {
            g.setColor(Color.GREEN);
            g.drawString(Integer.toString(QF), 560, 125);
        	g.setColor(colorBefore);
        }
        else {
            g.setColor(Color.RED);
            g.drawString(Integer.toString(QF), 560, 125);
        	g.setColor(colorBefore);
        }

        g.drawString("Saudade= ", 450, 160);
        if (Brain.Saudade) {
            g.setColor(Color.BLUE);
            g.drawString("Yes", 560, 160);
        	g.setColor(colorBefore);
        }
        else
            g.drawString("No", 560, 160);

        g.drawString("Anxiety= ", 450, 195);
        if (Brain.Ansiedade) {
            g.setColor(Color.ORANGE);
            g.drawString("Yes", 560, 195);
        	g.setColor(colorBefore);
        }
        else
            g.drawString("No", 560, 195);

        g.drawString("Homeostase = ", 450, 55);
        if ( Emotions.Normal>= 0) {
            g.setColor(Color.GREEN);
            g.drawString(Integer.toString(Emotions.Normal),
            		560, 55);
        	g.setColor(colorBefore);
        }
        else {
            g.setColor(Color.RED);
            g.drawString(Integer.toString(Emotions.Normal),
            		560, 55);
        	g.setColor(colorBefore);
        }

        g.drawString("Action  = ", 40, 445);
        if (Ink == 1)
            g.setColor(Color.RED);
        if (Ink == 3)
            g.setColor(Color.BLUE);
        if (Ink == 4)
            g.setColor(Color.ORANGE);
        if (Ink == 2 || Emotions.IdAct1 != Cerebellum.ESCape)
            g.setColor(Color.GREEN);
        if (Mind.Action[Brain.DRINK].active)
            g.drawString("Drink", 150, 445);
        if (Mind.Action[Brain.EAT].active)
            g.drawString("Eat", 240, 445);
        if (Mind.Action[Brain.WALK].active)
            g.drawString("Walk", 330, 445);
        if (Mind.Action[Brain.TURN_LEFT].active)
            g.drawString("Left", 420, 445);
        if (Mind.Action[Brain.TURN_RIGHT].active)
            g.drawString("Right", 510, 445);

        g.setColor(colorBefore);
        // ################################################
        g.drawString("Emotion= ", 40, 480);
        if (Emotions.ActualPain) {
        	g.setColor(Color.RED);
            g.drawString("Pain", 150, 480);
        	g.setColor(colorBefore);
        }
        if (Emotions.EmotionNew) {
        	g.setColor(Color.GREEN);
            g.drawString("New", 230, 480);
        	g.setColor(colorBefore);
        }

        g.drawString("Lovely =", 310, 480); // Beautiful
        g.drawString(Integer.toString(Lovely), 400, 480);

        if (Liberu.Already)
            if (Emotions.BodyAct[Brain.Happy].active) {
            	g.setColor(Color.GREEN);
                g.drawString("Happy", 480, 480);
            	g.setColor(colorBefore);
            }

        if (Liberu.Already)
            if (Emotions.BodyAct[Brain.Sad].active) {
            	g.setColor(Color.RED);
                g.drawString("Sad", 560, 480);
            	g.setColor(colorBefore);
            }

        if (Liberu.Already)
            if (Emotions.BodyAct[Brain.Afraid].active) {
            	g.setColor(Color.ORANGE);
                g.drawString("Afraid", 640, 480);
            	g.setColor(colorBefore);
            }
        
        if (Liberu.Already)
            if (Emotions.rir) {
            	g.setColor(Color.GREEN);
                g.drawString("Laugh", 480, 505);
            	g.setColor(colorBefore);
            }

        if (Liberu.Already)
            if (Emotions.choro) {
            	g.setColor(Color.RED);
                g.drawString("Cry", 560, 505);
            	g.setColor(colorBefore);
            }

        if (Liberu.Already)
            if (Mind.speak) {
            	g.setColor(Color.ORANGE);
                g.drawString("Speak", 640, 505);
                g.drawString("(" + Integer.toString(
                		Cortex.nSpeaks) + ")",
                		640, 535);
            	g.setColor(colorBefore);
            }
        
        if (execute) {
            g.drawString("Ta", 320 - 250, 515 + 0);
            g.drawString("Vi", 320 - 250, 515 + 35);
            g.drawString("Tc", 320 - 250, 515 + 70);
            g.drawString("So", 320 - 250, 515 + 105);
            g.drawString("Sm", 320 - 250, 515 + 140);
            g.drawString("PS", 320 - 250, 515 + 175);
            g.drawLine(350 - 250, 515 + 0, 350 - 250, 515 +
            		0 + 35 * Brain.SENSES); // eixo Y
            if (mind.past.nNeuronsTime > MaxDisplay)
            	m = MaxDisplay;
            else
            	m = mind.past.nNeuronsTime;
            g.drawLine(350 - 250, 515 + 0 + 35 *
            		Brain.SENSES, 350 + m - 250, 515 +
            		0 + 35 * Brain.SENSES); // eixo X
            n = 0;
            while (n < MaxDisplay) {
                if (n % 10 == 0) g.drawLine(350 + n+1 -
                		250, 515 + 0 + 35 * Brain.SENSES,
        				350 + n+1 - 250, 515 + 0 + 35 *
        				Brain.SENSES + 3);
                // escala 10 em 10 no eixo X
                n += 1;
            }

            g.drawString("Fired neurons, by Past...", 350 -
            		250, 515 + 0 + 35 * Brain.SENSES + 30);

			if (mind.past.time[0][0].pointer >
			MaxDisplay) {
				fimJanela = mind.past.time[0][0].pointer;
				pointerJanela = MaxDisplay;
				inicioJanela = mind.past.time[0][0].
						pointer - MaxDisplay;
			}
			else {
				fimJanela = MaxDisplay;
				pointerJanela = mind.past.time[0][0].
						pointer;
				inicioJanela = 0;
			}
	        // pointer
			g.drawLine(350 + pointerJanela+1 - 250, 515 +
					29, 350 + pointerJanela+1 - 250, 515 +
					0 + 35 * Brain.SENSES - 1);

			fDefault = g.getFont();
			f = new Font(g.getFont().getFontName(),
					g.getFont().getStyle(),
					16);
			g.setFont(f);
			g.drawString(Integer.toString(inicioJanela),
					350 - 250, 515 + 0 + 35 *
					Brain.SENSES + 15);
			g.drawString(Integer.toString(fimJanela),
					650 - 250, 515 + 0 + 35 *
					Brain.SENSES + 15);

			g.setFont(fDefault);
			// Neuron fires
            m = 0;
            while (m <= fimJanela && inicioJanela + m <
            		mind.past.nNeuronsTime) {
            	for (i=0; i < Brain.SENSES; i++)
            		if (mind.past.time[inicioJanela+m][i].
            				fire)
            			g.drawLine(350 + m+1 - 250, 515 +
            					0 + 35 * i - 1, 350 + m+1 -
            					250, 515 + 0 + 35 * i - 1);
            	m += 1;
            }
 			// gr�fico da rede "learn"
            m = 0;
            while (m <= fimJanela && inicioJanela + m <
            		mind.past.nNeuronsTime) {
            	for (i=0; i < mind.past.time
            			[inicioJanela+m][0].learn.size();
            			i++) {
            		bom = mind.past.time
            				[inicioJanela+m][0].
            				getLearn(i).emitter;
                    if (bom >= inicioJanela && bom <=
                    		fimJanela)
            			g.drawLine(350 + m+1 - 250, 515 +
            					210 - bom - inicioJanela,
            					350 + m+1 - 250, 515 +
            					210 - bom - inicioJanela);
                	}
            	m += 1;
            }
            // recent
            g.setColor(Color.RED);
            rct = Math.abs(Cortex.exec);
            if (rct >= inicioJanela && rct <= fimJanela) {
                g.drawString("+", 350 + rct -
                		inicioJanela - 3 - 250, 515 + 0 +
                		35 * Brain.SENSES + 4);
                g.setFont(f);
    			g.drawString(Integer.toString(rct), 350 +
    					rct - inicioJanela - 250, 515 +
    					0 + 35 * Brain.SENSES - 10);
                g.setFont(fDefault);
            }
            else {
            	if (rct < inicioJanela) {
                    g.setFont(f);
        			g.drawString(Integer.toString(rct),
        					350 - 250,
        					515 + 0 + 35 * Brain.SENSES -
        					10);
                    g.setFont(fDefault);
            	}
            }
 			// neur�nios que dispararam no Act
            g.drawString("Fired neurons, by Act...", 350 -
            		250, 515 + 30 + 35 *
            		Brain.SENSES + 30);
            n = 0;
            while (n < mind.past.nNeuronsAct && n <
            		MaxDisplay) {
        		if (mind.past.actNode[n].fire)
                    g.drawString("*", 350 + n+1 - 250,
                    		515 + 30 + 35 *
                    		(Brain.SENSES-1) - 3);
            	n += 1;
            }
            g.setColor(colorBefore);
        } // fim do if
    }
}