public void teach(double ordM, double invM) throws IOException{
        double[] in;
        NeuronKoh lastWin =  winner;
        while(!teached()){
            in = ImageGenerator.getInstance().getRandLetterNoise(ordM,invM);
            neurons.get(0).trigger(in);
            winnerNET = neurons.get(3).lastResult;
            winner = neurons.get(3);
            for(NeuronKoh n : neurons)
            {
                
                n.trigger(in);
                if ((n.getLastResult() > winnerNET)  )
                {   
                    winner = n;
                    winnerNET = n.getLastResult();
                }
            }
            winner.adjustWeights(in, 1);
            for(NeuronKoh n : neurons)
            {
                
                double s =  n.lastResult / (10 * winner.getLastResult());
                if (Double.isNaN(s) )
                    System.out.println("NAN");
                if ((n != winner) && (Math.abs(s) < 1) && (n.lastResult * winner.lastResult > 0))
                    n.adjustWeights(in, s);
            }
            winnerNum = neurons.indexOf(winner);
            System.out.println("winner is "+ String.valueOf(winnerNum));
            if (lastWin == winner)
                winner.timesWin++;
            iterCount++;
            this.setWeightsImage();
        }
        mw.getjButton1().enable();
        mw.getjButton2().enable();
        mw.getjButton3().enable();
        mw.getjButton4().enable();
    }