Пример #1
0
 private void _log_OnChangedDecision(object sender, CoreArgs e)
 {
     this.BeginInvoke(new MethodInvoker(delegate
     {
         if (e.PercentOfSuccessfull > 1)
         {
             throw new Exception();
         }
         chart1.Series["Series1"].Points.AddXY(e.Iteration, e.PercentOfSuccessfull);
         lblChange.Text = e.PercentOfSuccessfull.ToString("N4");
     }));
 }
Пример #2
0
        private void DontChangeDecision(CoreArgs arg)
        {
            var carIdx    = _dCarRnd.Next(_doors);
            var selectIdx = _dSelRnd.Next(_doors);

            if (carIdx == selectIdx)
            {
                arg.Successful = true;
                _succesAllNotChange++;
            }

            arg.AllSucces = _succesAllNotChange;
        }
Пример #3
0
        private void DoReplicationWrapper()
        {
            for (int i = 0; i < ReplicationCount; i++)
            {
                var arg = new CoreArgs(i);
                _repFunc(arg);

                if (_pauseDelay > 0)
                {
                    Thread.Sleep(_pauseDelay);
                }

                OnEndEachReplication?.Invoke(this, arg);
                _mrse.WaitOne();
            }
        }
Пример #4
0
        private void ChangedDecision(CoreArgs arg)
        {
            var carIdx  = _cCarRnd.Next(_doors);
            var sel1Idx = _cSel1Rnd.Next(_doors);
            var openIdx = _cOpenRnd.Next(_doors - 2);
            var sel2Idx = _cSel2Rnd.Next(_doors - 2);

            // otvorim dvere kde nie je auto a zaroven ktore neotvoril sutaziaci
            openIdx = (Math.Min(carIdx, sel1Idx) <= openIdx) ? (openIdx + 1) : openIdx;
            openIdx = (Math.Max(carIdx, sel1Idx) <= openIdx) ? (openIdx + 1) : openIdx;

            //vyberam dvere ktore nie su otvorene a zaroven nie su tie co som ako prve otvoril
            sel2Idx = (Math.Min(sel1Idx, openIdx) <= sel2Idx) ? (sel2Idx + 1) : sel2Idx;
            sel2Idx = (Math.Max(sel1Idx, openIdx) <= sel2Idx) ? (sel2Idx + 1) : sel2Idx;

            if (carIdx == sel2Idx)
            {
                arg.Successful = true;
                _succesAllChange++;
            }

            arg.AllSucces = _succesAllChange;
        }
Пример #5
0
 private void UpdateStatusChanged(object o, CoreArgs e)
 {
     OnChangedDecision?.Invoke(o, e);
 }