コード例 #1
0
        // wenn aktuelles feld weiß ist, dann rot färben - nach links drehen und eins vorwärts
        // wenn aktuelles feld rot, dann weiß färben - nach rechts drehen und eins vorwärts
        private void Aufgabe()
        {
            flow.StepCount = 1000;

            for (int iAnt = 0; iAnt < arrAnts.Length; iAnt++)
            {
                strAnt          = GLabReader.ReadAntFromFile(arrAnts[iAnt]);
                AnzahlZustaende = strAnt.Length;
                arrZustand      = new int[ImageWidth, ImageHeight];
                _image          = new Image <Rgb, byte>(ImageWidth, ImageHeight, new Rgb(Color.White));
                _frame.SetImage(_image);
                ant1.iZustand = 0;
                ant1.iCurrX   = (ImageWidth - 1) / 2;
                ant1.iCurrY   = (ImageHeight - 1) / 2;

                for (int i = 0; i < 10000000; i++)
                {
                    if (i % 1000 == 0)
                    {
                        _frame.Repaint();
                        Logger.Instance.LogInfo("" + i);
                    }

                    //for (Int64 ix = 0; ix < 10000; ix++) { }
                    flow.Wait();
                    ant1 = doStep(ant1);
                    ant2 = doStep(ant2);
                }
            }
        }