コード例 #1
0
        public void Reposition()
        {
            _panel.SuspendLayout();

            int count  = _controlerLists.Count;
            int width  = _panel.ClientSize.Width;
            int height = _panel.ClientSize.Height;

            List <Rectangle> rlist = new List <Rectangle>();
            int xInterval          = width / (2 * count + 1);

            for (int i = 0; i < count; i++)
            {
                IControler ctl  = _controlerLists[i];
                Control    ctrl = ctl.GetControl();
                if (ctrl == null)
                {
                    continue;
                }
                ctrl.Top   = (height - ctrl.Height) / 2;
                ctrl.Left  = xInterval * (i * 2 + 1);
                ctrl.Width = xInterval;
            }

            _panel.ResumeLayout();
        }
コード例 #2
0
        /// <summary>
        /// Train the network using specialized strategies.
        /// </summary>
        /// <returns>Whether the training was successful.</returns>
        public bool Train(IControler controler, Progress progress)
        {
            TrainingConfig config = controler.TrainingConfiguration;

            int patternCount = controler.PatternCount;
            int epochs = config.AutoTrainingEpochs.Value;
            int success = (int)(patternCount * config.AutoTrainingPercentSuccessful.Value);
            int howmany = controler.CountSuccessfulPatterns();

            if(howmany >= success)
                return true;

            int timeout = epochs;
            while(timeout-- >= 0)
            {
                if(progress != null)
                    progress((int)(100 * (epochs - (double)timeout) / epochs));

                for(int i=0;i<patternCount;i++)
                {
                    controler.SelectShuffledPattern(i);
                    controler.NeuralNetwork.TrainCurrentPattern(true, false);
                }

                howmany = controler.CountSuccessfulPatterns();
                if(howmany >= success)
                    return true;
            }

            // CLEAN UP:
            //controler.CalculateCurrentNetwork();
            return false;
        }
コード例 #3
0
 public void AddControler(GameResult gameResult, IControler controler)
 {
     controlers.Add(controler);
     if (created)
     {
         controler.OnCreation(gameResult, this);
     }
 }
コード例 #4
0
ファイル: Game_子彈.cs プロジェクト: z6842001/ken_2018
 public Game_子彈(Controler controler, IGame_傷害特效 _特效)
 {
     特效           = _特效;
     Controler    = controler;
     I子彈          = new Timer();
     I子彈.Enabled  = true;
     I子彈.Tick    += new EventHandler(子彈移動);
     I子彈.Interval = 10;
 }
コード例 #5
0
        /// <summary>
        /// Train the network using specialized strategies.
        /// </summary>
        /// <returns>Whether the training was successful.</returns>
        public bool Train(IControler controler, Progress progress)
        {
            TrainingConfig config = controler.TrainingConfiguration;
            BasicConfig basic = config.Basic;

            int patternCount = controler.PatternCount;
            int epochs = config.AutoTrainingEpochs.Value;
            int success = (int)(patternCount * config.AutoTrainingPercentSuccessful.Value);
            int howmany = controler.CountSuccessfulPatterns();

            double LRinitial = basic.LearningRate.Value;
            double LRstep = LRinitial * 0.7 / epochs;
            double LRcurrent = LRinitial;
            double magrin;

            if(howmany >= success)
                return true;

            int timeout = epochs;
            while(timeout-- >= 0)
            {
                basic.LearningRate.Value = LRcurrent;

                if(progress != null)
                    progress((int)(100 * (epochs - (double)timeout) / epochs));

                for(int i=0;i<patternCount;i++)
                {
                    controler.SelectShuffledPattern(i);
                    if(controler.CalculateCurrentNetwork(out magrin) != i)
                    {
                        controler.NeuralNetwork.TrainCurrentPattern(false, false);

                        howmany = controler.CountSuccessfulPatterns();
                        if(howmany >= success)
                        {
                            basic.LearningRate.Value = LRinitial;
                            return true;
                        }
                    }
                    else if(magrin < 0.5)
                    {
                        basic.LearningRate.Value = LRcurrent * 0.5;
                        controler.NeuralNetwork.TrainCurrentPattern(false, false);
                        basic.LearningRate.Value = LRcurrent;
                    }
                }

                LRcurrent -= LRstep;
            }

            // CLEAN UP:
            //controler.CalculateCurrentNetwork();
            basic.LearningRate.Value = LRinitial;
            return false;
        }
コード例 #6
0
 public HiLevComm(MqttClient _client, IControler _controler, SensData sensData_)
 {
     sensors   = new Sensors(sensData_);
     controler = _controler;
     client    = _client;
     StartTimer(OnTimeEvent, 10000);
     client.MqttMsgPublishReceived += Client_MqttMsgPublishReceived;
     client.Subscribe(new string[] { dataTopic }, new byte[] { MqttMsgBase.QOS_LEVEL_AT_LEAST_ONCE });
     OnTimeEvent(null, null);
 }
コード例 #7
0
 public ServerClient(TcpClient client, IControler baseControler)
 {
     Client    = client;
     formatter = new BinaryFormatter();
     //создаем обработчик сообшений от пользователя
     Controler = baseControler.GetNewControler(this);
     //обработка сообщений производитсва в отдельном потоке
     ThreadOfHandlerMsg = new Thread(StartReadMessage);
     ThreadOfHandlerMsg.Start();
 }
コード例 #8
0
        public RegisterActiveTraining()
        {
            
            InitializeComponent();
          //  activetraining.Visible = false;

           this.controler = new Controler(new Model());

           DataTable dt = controler.get_trainings();
            activetraining.Visible = true;
            activetraining.DataSource = dt;
        }
コード例 #9
0
        /// <summary>
        /// Train the network using specialized strategies.
        /// </summary>
        /// <returns>Whether the training was successful.</returns>
        public bool Train(IControler controler, Progress progress)
        {
            TrainingConfig config = controler.TrainingConfiguration;
            BasicConfig    basic  = config.Basic;

            int patternCount = controler.PatternCount;
            int epochs       = config.AutoTrainingEpochs.Value;
            int success      = (int)(patternCount * config.AutoTrainingPercentSuccessful.Value);
            int howmany      = controler.CountSuccessfulPatterns();

            double LRinitial = basic.LearningRate.Value;
            double LRstep    = LRinitial * 0.7 / epochs;
            double LRcurrent = LRinitial;

            if (howmany >= success)
            {
                return(true);
            }

            int timeout = epochs;

            while (timeout-- >= 0)
            {
                basic.LearningRate.Value = LRcurrent;

                if (progress != null)
                {
                    progress((int)(100 * (epochs - (double)timeout) / epochs));
                }

                for (int i = 0; i < patternCount; i++)
                {
                    controler.SelectShuffledPattern(i);
                    controler.NeuralNetwork.TrainCurrentPattern(true, false);
                }

                howmany = controler.CountSuccessfulPatterns();
                if (howmany >= success)
                {
                    basic.LearningRate.Value = LRinitial;
                    return(true);
                }

                LRcurrent -= LRstep;
            }

            // CLEAN UP:
            //controler.CalculateCurrentNetwork();
            basic.LearningRate.Value = LRinitial;
            return(false);
        }
コード例 #10
0
        public bool Receive(IControler message)
        {
            if (_disruptor == null)
            {
                return(false);
            }

            var rawData = new ReceiveData
            {
                Message = message,
            };

            return(_disruptor.Publish(rawData));
        }
コード例 #11
0
ファイル: Server.cs プロジェクト: map82top/NewCSInteraction
 //конструктор
 public Server(string ipAdress, int port, IControler baseControler)
 {
     if (baseControler != null)
     {
         IPAdress         = ipAdress;
         Port             = port;
         BaseControler    = baseControler;
         ConnectedClients = new List <ServerClient>();
     }
     else
     {
         throw new Exception("Не передано исключения по умолчанию");
     }
 }
コード例 #12
0
ファイル: User_Information.cs プロジェクト: z6842001/ken_2018
        public User_Information(IfrmMain x)
        {
            InitializeComponent();

            Main      = x;
            controler = x._controler;

            this.FormClosing += new FormClosingEventHandler(User_Information_FormClosing);
            //加入關閉事件-User_Information_FormClosing
            #region Button 建立
            Bitmap add   = new Bitmap(Properties.Resources.加, new Size(35, 35));
            Bitmap sub   = new Bitmap(Properties.Resources.減, new Size(35, 35));
            Bitmap _save = new Bitmap(Properties.Resources.Save, new Size(100, 50));

            /*button設定*/
            Attack_Add.BackgroundImage     = add;
            Attack_Add.Size                = Attack_Add.BackgroundImage.Size;
            Speed_Add.BackgroundImage      = add;
            Speed_Add.Size                 = Attack_Add.BackgroundImage.Size;
            CritAttack_Add.BackgroundImage = add;
            CritAttack_Add.Size            = Attack_Add.BackgroundImage.Size;
            Crit_Add.BackgroundImage       = add;
            Crit_Add.Size = Attack_Add.BackgroundImage.Size;

            Attack_Low.BackgroundImage     = sub;
            Attack_Low.Size                = Attack_Add.BackgroundImage.Size;
            Speed_Low.BackgroundImage      = sub;
            Speed_Low.Size                 = Attack_Add.BackgroundImage.Size;
            CritAttack_Low.BackgroundImage = sub;
            CritAttack_Low.Size            = Attack_Add.BackgroundImage.Size;
            Crit_Low.BackgroundImage       = sub;
            Crit_Low.Size = Attack_Add.BackgroundImage.Size;
            /*button設定*/
            #endregion

            Save.BackgroundImage = _save;
            Save.Size            = _save.Size;



            Level.Text    = controler.Get_Level.ToString();;
            Points_Attack = 0;
            Speed.Text    = "0";
            Crit機率.Text   = "0";
            Crit傷害.Text   = "0";
            Points.Text   = controler.Get_剩餘點數.ToString();
            Attack.Text   = controler.Information_傷害Text;
        }
コード例 #13
0
        public void RemoveList(IControler list)
        {
            if (_controlerLists.Contains(list))
            {
                list.Panel         = null;
                list.ItemSelected -= new ItemSelectedHandler(list_ItemSelected);

                _controlerLists.Remove(list);

                Control ctrl = list.GetControl();
                if (!_panel.Controls.Contains(ctrl))
                {
                    _panel.Controls.Add(ctrl);
                }
            }
        }
コード例 #14
0
ファイル: Engine.cs プロジェクト: sirjordan/1024
 public Engine(int size, int sizeInPixels, IControler controlerInterface)
 {
     if (size >= 3)
     {
         this.size = size;
         this.Grid = new Number[size, size];
         this.rnd = new Random();
         this.Score = 0;
         this.controler = controlerInterface;
         this.SizeInPixels = sizeInPixels;
     }
     else
     {
         throw new ArgumentOutOfRangeException("Size should be greater than 3");
     }
 }
コード例 #15
0
ファイル: Engine.cs プロジェクト: magesol/1024
 public Engine(int size, int sizeInPixels, IControler controlerInterface)
 {
     if (size >= 3)
     {
         this.size         = size;
         this.Grid         = new Number[size, size];
         this.rnd          = new Random();
         this.Score        = 0;
         this.controler    = controlerInterface;
         this.SizeInPixels = sizeInPixels;
     }
     else
     {
         throw new ArgumentOutOfRangeException("Size should be greater than 3");
     }
 }
コード例 #16
0
        public monster(IfrmMain main, IControler controler, IGame_User能力 _User) //建構式
        {
            test = new test(this);
            test.Show();
            Main = main;
            //Monster_Blood = 基礎血量 + ((level - 1) * 0.1 * 基礎血量);    //計算血量

            // _monster.Add(new Monster_Information(基礎血量, 初始座標));
            Controler = controler;
            user      = _User;


            Monster_Tick          = new Timer();
            Monster_Tick.Enabled  = true;
            Monster_Tick.Tick    += new EventHandler(Monster_Move);
            Monster_Tick.Interval = 10;
        }
コード例 #17
0
        /// <summary>
        /// Train the network using specialized strategies.
        /// </summary>
        /// <returns>Whether the training was successful.</returns>
        public bool Train(IControler controler, Progress progress)
        {
            TrainingConfig config = controler.TrainingConfiguration;

            int patternCount = controler.PatternCount;
            int epochs       = config.AutoTrainingEpochs.Value;
            int success      = (int)(patternCount * config.AutoTrainingPercentSuccessful.Value);
            int howmany      = controler.CountSuccessfulPatterns();

            if (howmany >= success)
            {
                return(true);
            }

            int timeout = epochs;

            while (timeout-- >= 0)
            {
                if (progress != null)
                {
                    progress((int)(100 * (epochs - (double)timeout) / epochs));
                }

                for (int i = 0; i < patternCount; i++)
                {
                    controler.SelectShuffledPattern(i);
                    if (controler.CalculateCurrentNetwork() != i)
                    {
                        controler.NeuralNetwork.TrainCurrentPattern(false, false);

                        howmany = controler.CountSuccessfulPatterns();
                        if (howmany >= success)
                        {
                            return(true);
                        }
                    }
                }
            }

            // CLEAN UP:
            //controler.CalculateCurrentNetwork();
            return(false);
        }
コード例 #18
0
        public void AddList(IControler list)
        {
            if (list == null)
            {
                return;
            }

            list.Panel         = this;
            list.ItemSelected += new ItemSelectedHandler(list_ItemSelected);

            _controlerLists.Add(list);

            Control ctrl = list.GetControl();

            if (ctrl != null)
            {
                _panel.Controls.Add(ctrl);
                ctrl.Visible = true;
            }
        }
コード例 #19
0
        /// <summary>
        /// 控制器处理请求
        /// </summary>
        /// <param name="context">上下文对象</param>
        private static void CallControler(HttpContext context) //控制器处理请求函数,利用反射来做,复杂性大为降低
        {
            string Controler_name = "";

            if (context.Session["accctx"] == null && !cachecookie())
            {
                if (context.Request["state"] != null)   //session对象 && mm缓存中对象木有, state有值(第三方登录标识) 表示没登录  进入第三方登录
                {
                    Controler_name = "ThreeLoginControler";
                }
                else
                {
                    Controler_name = "loginControler";   //session对象 && mm缓存中对象木有,表示没登录,加载登录控制器
                }
            }
            else if (context.Request["ctrl"] == null && cachecookie())  //mm缓存中对象有值 且没有控制器  则加载  index控制器
            {
                Controler_name = "indexControler";
            }
            else if (context.Request["ctrl"] != null)                   //此参数表示控制器名
            {
                Controler_name = context.Request["ctrl"] + "Controler"; //得到控制器名
            }
            else
            {
                Controler_name = "defaultControler"; //如果不指定则使用默认控制器,可以放在web.config中。
            }
            string nspace        = "Web.Control";    //控制器命名空间,可以放在web.config中。
            Assembly res         = null;             //命名空间程序集对象
            IControler Controler = null;             //用于接收控制器

            res = getNamespace();                    //获得程序集对象
            if (res != null)
            {
                Controler = (IControler)res.CreateInstance(nspace + "." + Controler_name); //动态创建控制器实例
                if (Controler != null)
                {
                    Controler.ActionPerform(context);
                }
            }
        }
コード例 #20
0
 public bool SendControlerMessage(IControler message, byte flag = (byte)QueueType.MainQueue)
 {
     try
     {
         if (message == null)
         {
             throw new Exception("null message");
         }
         if (_publishDisruptor != null)
         {
             return(_publishDisruptor.Publish(new List <IMsg>()
             {
                 message
             }, flag));
         }
     }
     catch (Exception ex)
     {
         LogTo.Error(ex.ToString());
     }
     return(false);
 }
コード例 #21
0
        public trainers()
        {
            InitializeComponent();
            controler = new Controler(new Model());

        }
コード例 #22
0
 private void list_ItemSelected(IControler ctrl, IItem item)
 {
     RefreshSelectedRelations(item);
     Redraw();
 }
コード例 #23
0
 protected ControlerEffect(ControlerEffect copy)
     : base(copy)
 {
     this.controler = (IControler)copy.controler.Clone();
 }
コード例 #24
0
 public Clients()
 {
     InitializeComponent();
     button1.Text = "שמור מתאמן";
    this.controler = new Controler(new Model());
 }
コード例 #25
0
 public TaskControler(IStreamer <string, List <Task> > streamer, IControler <Task> controler)
 {
     dataStreamer = streamer;
     Controler    = controler;
 }
コード例 #26
0
 public training()
 {
     InitializeComponent();
     this.controler = new Controler(new Model());
 }
コード例 #27
0
ファイル: MainView.xaml.cs プロジェクト: yhyahaha/Verza
 public MainView(IControler mainViewModel)
 {
     InitializeComponent();
     this.DataContext = mainViewModel;
 }
コード例 #28
0
 public ControlerEffect(TargetingInfo effectsWho, EffectTypes harmfulEffectTypes, EffectSounds effectSounds, LifeSpan lifeTime, IControler controler)
     : base(effectsWho, harmfulEffectTypes | EffectTypes.Controls, effectSounds, lifeTime)
 {
     this.controler = controler;
 }