コード例 #1
0
        public void AddRuns(TCheck Check, ref TRuns Runs)
        {
            for (int i = 0; i < Lists.Count; i++)
            {
                TNode Node = (TNode)Lists[i];

                TRun Run = new TRun(Check, Node.Pos);

                ArrayList arr = Up(Node);

                for (int j = 0; j < arr.Count; j++)
                {
                    Run.Killed.Add(((TNode)arr[j]).Killed);
                }

                Runs.Add(Run);

                TCell[] Addition = Node.Pos.NearsDama(Node.dir, Pole);

                for (int k = 1; k < Addition.Count(); k++)
                {
                    TRun ARun = new TRun(Check, Addition[k]);

                    for (int j = 0; j < Run.Killed.Count; j++)
                    {
                        ARun.Killed.Add(Run.Killed[j]);
                    }

                    Runs.Add(ARun);
                }
            }
        }
コード例 #2
0
        void AddRun(TRuns Runs, int dir)
        {
            TCell  Near;
            TCheck Who;
            TCheck W2;
            TRun   R2;

            Near = Pos.Near(dir);
            if (Pole.Who(Near, out Who))
            {
                if (Who == null)
                {
                    Runs.Add(new TRun(this, Near));
                }
                else
                {
                    if (Who.C != C)
                    {
                        Near = Who.Pos.Near(dir);
                        if (Pole.Who(Near, out W2))
                        {
                            if (W2 == null)
                            {
                                R2 = new TRun(this, Near);
                                R2.Killed.Add(Who);
                                Runs.Add(R2);
                            }
                        }
                    }
                }
            }
        }
コード例 #3
0
        public TRuns GetRuns(TPole Pole)
        {
            this.Pole = Pole;

            TRuns Res = new TRuns();

            if (Dama)
            {
                AddRunDama(Res, 1);

                AddRunDama(Res, 2);

                AddRunDama(Res, 3);

                AddRunDama(Res, 4);
            }
            else
            {
                if (C == WB.W)
                {
                    AddRun(Res, 1);

                    AddRun(Res, 2);
                }
                else
                {
                    AddRun(Res, 3);

                    AddRun(Res, 4);
                }
            }


            return(Res);
        }
コード例 #4
0
        void AddRunDama(TRuns Runs, int dir)
        {
            TCell[] Nears = Pos.NearsDama(dir, Pole);

            for (int i = 1; i < Nears.Count(); i++)
            {
                Runs.Add(new TRun(this, Nears[i]));
            }
        }
コード例 #5
0
        public bool Run(TPole Pole, TRun R)
        {
            TRuns RunsKill = GetRunsKill(Pole);

            if (RunsKill.Count > 0)
            {
                TRun Run;
                if (R == null)
                {
                    Run = RunsKill.GetR();
                }
                else
                {
                    Run = R;
                }

                SetPos(Run.PosTo);

                for (int i = 0; i < Run.Killed.Count; i++)
                {
                    TCheck K = (TCheck)Run.Killed[i];
                    g.Children.Remove(K.O[0]);
                    g.Children.Remove(K.O[1]);
                    if (K.C == WB.W)
                    {
                        Pole.CW.Remove(K);
                    }
                    else
                    {
                        Pole.CB.Remove(K);
                    }
                }

                return(true);
            }

            TRuns Runs = GetRuns(Pole);

            if (Runs.Count > 0)
            {
                TRun Run;
                if (R == null)
                {
                    Run = Runs.GetR();
                }
                else
                {
                    Run = R;
                }

                SetPos(Run.PosTo);
                return(true);
            }

            return(false);
        }
コード例 #6
0
        public TRuns GetRunsKill(TPole Pole)
        {
            this.Pole = Pole;

            TRuns Res = new TRuns();

            if (Dama)
            {
                Tree = null;
                AddRunKillDama(null, 1, null);
                if (Tree != null)
                {
                    Tree.AddRuns(this, ref Res);
                    Tree = null;
                }


                AddRunKillDama(null, 2, null);
                if (Tree != null)
                {
                    Tree.AddRuns(this, ref Res);
                    Tree = null;
                }

                AddRunKillDama(null, 3, null);
                if (Tree != null)
                {
                    Tree.AddRuns(this, ref Res);
                    Tree = null;
                }

                AddRunKillDama(null, 4, null);
                if (Tree != null)
                {
                    Tree.AddRuns(this, ref Res);
                    Tree = null;
                }
            }
            else
            {
                Tree = null;
                AddRunKill(null, 1, null);
                if (Tree != null)
                {
                    Tree.AddRuns(this, ref Res);
                    Tree = null;
                }


                AddRunKill(null, 2, null);
                if (Tree != null)
                {
                    Tree.AddRuns(this, ref Res);
                    Tree = null;
                }

                AddRunKill(null, 3, null);
                if (Tree != null)
                {
                    Tree.AddRuns(this, ref Res);
                    Tree = null;
                }

                AddRunKill(null, 4, null);
                if (Tree != null)
                {
                    Tree.AddRuns(this, ref Res);
                    Tree = null;
                }
            }

            return(Res);
        }