//配置情報の多角形poly, 形状情報initialPuzzleが与えられるので、何番のピースが与えられたかを特定せよ。
        //ピース番号, dstPointId, srcPointId, turnflagをTuple<int, int, int, bool> で返す。
        //どれにも当てはまらない場合はnullを返すこと。これは支援システムと違って、かなり厳密に動作する。
        private Tuple <int, int, int, bool> DetectPiece(Puzzle initialPuzzle, Poly poly)
        {
            for (int i = 0; i < initialPuzzle.initPieceNum; i++)
            {
                Poly srcPoly = initialPuzzle.pieces[i].Clone();
                if (srcPoly.Count != poly.Count)
                {
                    continue;
                }
                if (Math.Abs(srcPoly.Area - poly.Area) >= 0.5)
                {
                    continue;
                }
                for (int dstPointId = 0; dstPointId < poly.Count; dstPointId++)
                {
                    double dArg = poly.Arg(dstPointId);
                    if (dArg < 0)
                    {
                        dArg += 2 * Math.PI;
                    }
                    for (int srcPointId = 0; srcPointId < srcPoly.Count; srcPointId++)
                    {
                        double sArg = srcPoly.Arg(srcPointId);
                        if (sArg < 0)
                        {
                            sArg += 2 * Math.PI;
                        }
                        if (Math.Abs(dArg - sArg) * 180 / Math.PI > 0.1)
                        {
                            continue;
                        }                                                                                       //枝刈り

                        //実際に動かしてみる
                        move(poly, srcPoly, dstPointId, srcPointId, false, false);
                        if (IsSamePoly(poly, srcPoly, dstPointId, srcPointId))
                        {
                            return(new Tuple <int, int, int, bool>(i, dstPointId, srcPointId, false));
                        }
                        move(poly, srcPoly, dstPointId, srcPointId, true, false);
                        if (IsSamePoly(poly, srcPoly, dstPointId, srcPointId))
                        {
                            return(new Tuple <int, int, int, bool>(i, dstPointId, srcPointId, true));
                        }
                        srcPoly.Turn(false);
                    }
                }
            }
            return(null);
        }