示例#1
0
        private void CheckConvergence(Piece p)
        {
            if (p.CheckConvergence(this)) //収束したら
            {
                Console.WriteLine("No.{0}が{1}に収束", p.Number, p.SingleType);
                // PC[PlayerNum,]++;
                int PlayerNum = GetPlayerNumber(p.Orient);
                int PieceNum = p.SingleType.GrHandle % CountPlys.Length;
                if(++PieceCounters[PlayerNum,PieceNum] >= CountPlys[PieceNum])
                {
                    List<Piece> list = new List<Piece>();

                    Console.WriteLine("矛盾調査開始");
                    foreach (var v in Board)
                    {
                        if (v.SingleType != p.SingleType && v.Orient == p.Orient) //同じプレイヤーのやつ
                        {
                            Console.WriteLine("\tNo.{0}を調査中", v.Number);
                            if (v.RemoveConvergencedType(this, p.SingleType))
                            {
                                list.Add(v);
                            }
                        }
                    }
                    Console.WriteLine("持ち駒を調査中");
                    foreach (var q in PlayerStock)
                    {
                        foreach (var v in q)
                        {
                            if (v.SingleType != p.SingleType && v.Orient == p.Orient) //同じプレイヤーのやつ
                            {
                                Console.WriteLine("\tNo.{0}を調査中", v.Number);
                                if (v.RemoveConvergencedType(this, p.SingleType))
                                {
                                    list.Add(v);
                                }
                            }
                        }
                    }
                    Console.WriteLine("調査終了");
                    foreach (var v in list)
                    {
                        CheckConvergence(v);
                    }
                }

                foreach (var q in PlayerStock)
                {
                    List<Piece> rem = new List<Piece>();
                    foreach (var v in q)
                    {
                        if (v.Orient == Position.Orientation.None)
                        {
                            rem.Add(v);
                        }
                    }
                    foreach (var v in rem)
                    {
                        q.Remove(v);
                    }
                }
            }
        }