Beispiel #1
0
 public override void Execute()
 {
     for (int x = 0; x < field.Height; ++x)
     {
         for (int y = 0; y < field.Width; ++y)
         {
             if (field.isChanged(x, y))
             {
                 for (int i = -1; i <= 1; ++i)
                 {
                     for (int j = -1; j <= 1; ++j)
                     {
                         UpdateCellEvent EV = new UpdateCellEvent(field, x + i, y + j);
                         EV.eTime = eTime + 1;
                         DEVS.ModelEvent.Enque(EV);
                     }
                 }
             }
         }
     }
     field.Swap();
 }
Beispiel #2
0
        private void NextButton_Click(object sender, EventArgs e)
        {
            if (newCells.Count > 0)
            {
                foreach (var cell in newCells)
                {
                    field.SetCell(cell.X, cell.Y, true);
                    ScheduleUpdateEvent.Add(field, cell.X, cell.Y, DEVS.GlobalTime);
                }
                newCells.Clear();
            }

            field.Swap();

            DeleteEvents.Add(field, DEVS.GlobalTime);

            if (showEvents)
            {
                seenCells.Clear();
            }
            double time = DEVS.GlobalTime;

            while (time == DEVS.GlobalTime && DEVS.ProcessNextEvent())
            {
                if (showEvents)
                {
                    addSeenCell();
                }
            }

            //if (DEVS.EventCount <= 0)
            //{
            //	MessageBox.Show("No events");
            //}

            graphics.Clear();
            drawFrame();
        }