예제 #1
0
 public static DataTable Search(string keyword)
 {
     try
     {
         DbManager      dm      = DbManager.Ins;
         MySqlParameter p_input = new MySqlParameter("_keyword", MySqlDbType.String);
         p_input.Value = keyword;
         MySqlParameter[] pars = new MySqlParameter[] { p_input };
         DataTable        dt   = dm.ExecuteProcQuery("Project_SearchWithKeyword", pars);
         if (dt == null)
         {
             return(null);
         }
         dt.Columns.Add("time_", typeof(DateTime));
         dt.Columns.Add("mode_", typeof(string));
         dt.Columns.Add("type_", typeof(string));
         foreach (DataRow dr in dt.Rows)
         {
             double          t    = (double)dr["time"];
             CalculationMode mode = (CalculationMode)dr["mode"];
             GeometrySchema  type = (GeometrySchema)dr["type"];
             dr["time_"] = GlobalTool.ConvertIntDateTime(t);
             dr["mode_"] = (mode == CalculationMode.Temperature?"温度":"厚度");
             dr["type_"] = (type == GeometrySchema.Plate ? "平板" : "圆筒");
         }
         dt.Columns.Remove("mode");
         dt.Columns.Remove("type");
         return(dt);
     }
     catch (Exception)
     {
         return(null);
     }
 }
예제 #2
0
 private void InitializeCalculationMode()
 {
     CalculatorMode        = new CalculationMode(modeOnStartup: CalcMode.RPN);
     rbSelectRPN.IsChecked = CalculatorMode.CurrentMode == CalcMode.RPN;
     rbSelectTI.IsChecked  = !rbSelectRPN.IsChecked;
     UpdateCalculationMode();
 }
예제 #3
0
파일: Light.cs 프로젝트: hyyly/teslagame
 public Light(Vector3f position, Color4f color, float start, float end, CalculationMode lightCalculation)
 {
     this.position = position;
     this.color    = color;
     this.start    = start;
     this.end      = end;
     this.len      = end - start;
     this.lightCalculation = lightCalculation;
 }
예제 #4
0
파일: Light.cs 프로젝트: topfs2/teslagame
 public Light(Vector3f position, Color4f color, float start, float end, CalculationMode lightCalculation)
 {
     this.position         = position;
     this.color            = color;
     this.start            = start;
     this.end              = end;
     this.len              = end - start;
     this.lightCalculation = lightCalculation;
 }
예제 #5
0
 public DGSystemElement(DGMODE myMode,CalculationMode calcMode, double leftSpaceBoundary, double rightSpaceBoundary, int polynomOrder,int systemDimension, Func<Vector, Vector, double, Vector> NumericalFluxFunction, Func<Vector,double, double, Vector> InhomogenuousFunction, Func<Vector, Vector> FluxFunction, Func<Vector,bool, Vector> InitialFunction)
 {
     this.calcMode = calcMode;
     this.leftSpaceBoundary = leftSpaceBoundary;
     this.rightSpaceBoundary = rightSpaceBoundary;
     this.N = polynomOrder;
     this.SystemDimension = systemDimension;
     this.FluxFunction = FluxFunction;
     this.NumericalFluxFunction = NumericalFluxFunction;
     this.InhomogenuousFunction = InhomogenuousFunction;
     this.InitialFunction = InitialFunction;
     this.myMode = myMode;
     Initialize();
 }
예제 #6
0
        public HealthIndexCalculator(ServiceContext serviceParamaters)
        {
            if (serviceParamaters.CodePackageActivationContext.GetConfigurationPackageNames().Contains("Config"))
            {
                ConfigurationPackage configPackage = serviceParamaters.CodePackageActivationContext.GetConfigurationPackageObject("Config");

                this.UpdateConfigSettings(configPackage.Settings);

                serviceParamaters.CodePackageActivationContext.ConfigurationPackageModifiedEvent
                    += this.CodePackageActivationContext_ConfigurationPackageModifiedEvent;
            }
            else
            {
                this.calculationMode = CalculationMode.Simple;
            }
        }
예제 #7
0
        private void UpdateConfigSettings(ConfigurationSettings configSettings)
        {
            try
            {
                KeyedCollection <string, ConfigurationProperty> parameters = configSettings.Sections["HealthIndexCalculator.Settings"].Parameters;

                string scoreCalculationMode = parameters["ScoreCalculationMode"].Value;

                this.calculationMode = String.Equals("Mode1", scoreCalculationMode, StringComparison.OrdinalIgnoreCase)
                    ? CalculationMode.Simple
                    : CalculationMode.Detailed;
            }
            catch (Exception)
            {
                //do nothing
            }
        }
예제 #8
0
        public Task Calculate(CancellationToken cancellationToken, CalculationMode mode, int playerLevel, int atLeast)
        {
            // If units is empty, the probability is 0.
            if (units.Count == 0)
            {
                return(Task.CompletedTask);
            }

            if (mode == CalculationMode.Probability)
            {
                return(Task.Run(() => CalculateProbability(cancellationToken, playerLevel, atLeast)));
            }
            else
            {
                return(Task.Run(() => CalculateComparison(cancellationToken, atLeast)));
            }
        }
예제 #9
0
        public static Operation Build(CalculationStack stack, CalculationMode mode, OperationType type)
        {
            // Zacznij od sprawdzania operacji ktore sa niezalezne od trybu
            switch (type)
            {
            case OperationType.C:
                return(new Erase(stack));

            case OperationType.AC:
                return(new Clear(stack));

            case OperationType.ENTER:
                return(new Enter(stack));

            case OperationType.POP:
                return(new Pop(stack));

            case OperationType.SWAP:
                return(new Swap(stack));

            case OperationType.MC:
                return(new MemoryClear(stack));

            case OperationType.MR:
                return(new MemoryRecall(stack));

            case OperationType.Mplus:
                return(new MemoryPlus(stack));

            case OperationType.Mminus:
                return(new MemoryMinus(stack));
            }

            if (mode == CalculationMode.Date)
            {
                switch (type)
                {
                case OperationType.SUB:
                    return(new SubDate(stack));

                case OperationType.ADD:
                    return(new AddDate(stack));
                }
            }

            if (mode == CalculationMode.Time)
            {
                switch (type)
                {
                case OperationType.SUB:
                    return(new SubTime(stack));

                case OperationType.ADD:
                    return(new AddTime(stack));
                }
            }

            switch (type)
            {
            case OperationType.SQRT:
                return(new SqrtNumber(stack));

            case OperationType.POW:
                return(new PowerNumber(stack));

            case OperationType.INV_X:
                return(new InvertNumber(stack));

            case OperationType.PLUS_MINUS:
                return(new ChangeSign(stack));

            case OperationType.PERCENT:
                return(new PercentNumber(stack));

            case OperationType.DIV:
                return(new DivNumber(stack));

            case OperationType.MUL:
                return(new MulNumber(stack));

            case OperationType.SUB:
                return(new SubNumber(stack));

            case OperationType.ADD:
                return(new AddNumber(stack));
            }

            return(null);
        }
예제 #10
0
 private void InitializeCalculationMode()
 {
     CalculatorMode = new CalculationMode(modeOnStartup: CalcMode.RPN);
     rbSelectRPN.IsChecked = CalculatorMode.CurrentMode == CalcMode.RPN;
     rbSelectTI.IsChecked = !rbSelectRPN.IsChecked;
     UpdateCalculationMode();
 }
        public CalculationEntry CalculateCameraParameters(DistanceToDevice distanceToDevice, DistanceToObject distanceToObject, CalculationMode calculation)
        {
            if (distanceToDevice is null)
            {
                throw new ArgumentException(nameof(distanceToDevice));
            }

            if (distanceToObject is null)
            {
                throw new ArgumentException(nameof(distanceToObject));
            }
            var aCathet    = new Side(distanceToObject.Val, TriangleSideTypes.Cathet);
            var bCathet    = new Side(distanceToDevice.Val - Constant.AverageHumanHeight, TriangleSideTypes.Cathet);
            var hypotenuse = new Side(GetHypotenusesLength(aCathet.Length, bCathet.Length), TriangleSideTypes.Hypotenuse);

            var tangentAlpha = (double)bCathet.Length / (double)aCathet.Length;
            var alphaDegrees = Math.Round(Math.Atan(tangentAlpha) * Constant.DegreesInRadian, 2);
            var alphaAngle   = new Angle(alphaDegrees);
            var bAngle       = new Angle(Constant.RightAngleDegrees);
            var cAngle       = new Angle(Constant.FullTriangleDegrees - bAngle.Degrees - alphaAngle.Degrees);

            var calculationEntry = new CalculationEntry()
            {
                Height              = distanceToDevice.Val,
                AlfaAngle           = alphaAngle.Degrees,
                CreationDateTime    = DateTime.Now,
                DistanceAboveObject = bCathet.Length,
                DistanceToObject    = distanceToObject.Val
            };

            if (calculation == CalculationMode.WithSave)
            {
                Save(calculationEntry);
            }

            return(calculationEntry);
        }
예제 #12
0
    /// <summary>
    /// 移動力を元に移動可能範囲の計算を行います
    /// </summary>
    /// <returns>The remaining move amount infos.</returns>
    /// <param name="startCell">Start cell.</param>
    /// <param name="moveAmount">Move amount.</param>
    MoveAmountInfo[] GetRemainingMoveAmountInfos(Main_Cell startCell, int moveAmount, CalculationMode mode)
    {
        //座標と移動可能距離を持つリストを用意する まずは現在位置で最大の移動可能距離
        var infos = new List <MoveAmountInfo>();

        infos.Add(new MoveAmountInfo(startCell.X, startCell.Y, moveAmount));

        //残り移動可能距離を1ずつ減らしていって、0になるまでループまわす
        for (var i = moveAmount; i >= 0; i--)
        {
            //追加していく移動可能距離リスト作成
            var appendInfos = new List <MoveAmountInfo>();

            //amountはそのセルでの残り移動可能距離 まずは現在位置からスタート
            foreach (var calcTargetInfo in infos.Where(info => info.amount == i))
            {
                // 四方のマスの座標配列を作成
                var calcTargetCoordinate  = calcTargetInfo.coordinate;                  //TODO ???
                var aroundCellCoordinates = new Coordinate[]                            //上下左右の座標配列
                {
                    new Coordinate(calcTargetCoordinate.x - 1, calcTargetCoordinate.y), //左
                    new Coordinate(calcTargetCoordinate.x + 1, calcTargetCoordinate.y), //右
                    new Coordinate(calcTargetCoordinate.x, calcTargetCoordinate.y - 1), //上
                    new Coordinate(calcTargetCoordinate.x, calcTargetCoordinate.y + 1), //下
                };

                // 四方のマスの残移動力を計算 上下左右マスの座標を順に取り出し
                foreach (var aroundCellCoordinate in aroundCellCoordinates)
                {
                    //FirstOrDefaultとは? 現在地から上下左右の座標を元にマップの座標を取得
                    var targetCell = cells.FirstOrDefault(c => c.X == aroundCellCoordinate.x && c.Y == aroundCellCoordinate.y);

                    //nullはマイナス座標などでマップの範囲外とか infoとappendInfosにもう同じ座標のセルが有ればスルー
                    //もうそのセルは移動可能にならないし
                    if (null == targetCell ||
                        infos.Any(info => info.coordinate.x == aroundCellCoordinate.x && info.coordinate.y == aroundCellCoordinate.y) ||
                        appendInfos.Any(info => info.coordinate.x == aroundCellCoordinate.x && info.coordinate.y == aroundCellCoordinate.y))
                    {
                        // マップに存在しない、または既に計算済みの座標はスルー
                        continue;
                    }

                    //移動先に宝箱がある場合、敵、味方共に移動不可
                    if (IsDestinationTreasureExist(aroundCellCoordinate))
                    {
                        continue;
                    }

                    if (mode == CalculationMode.PLAYER_MOVE)
                    {
                        //210212 プレイヤー移動時、敵の居るセルは移動不可能にする 攻撃時は選択可能
                        EnemyModel destinationEnemy = enemyContainer.GetComponentsInChildren <EnemyModel>().FirstOrDefault(
                            c => c.x == aroundCellCoordinate.x && c.y == aroundCellCoordinate.y);
                        if (destinationEnemy != null)
                        {
                            continue;
                        }
                    }
                    else if (mode == CalculationMode.ENEMY_MOVE || mode == CalculationMode.ENEMY_SEARCH)
                    {
                        //同じように、敵はプレイヤーが居るセルには移動出来ない
                        PlayerModel destinationPlayer = unitContainer.GetComponentsInChildren <PlayerModel>().FirstOrDefault(
                            c => c.x == aroundCellCoordinate.x && c.z == aroundCellCoordinate.y);
                        if (destinationPlayer != null)
                        {
                            continue;
                        }
                    }

                    //残りの移動可能距離を取得、対象セルから移動可能コストを引く
                    int remainingMoveAmount;
                    remainingMoveAmount = i - targetCell.Cost;

                    appendInfos.Add(new MoveAmountInfo(aroundCellCoordinate.x, aroundCellCoordinate.y, remainingMoveAmount));
                }//四方のマス取得ループ
            }
            //上下左右の座標リストを取得し終わったらinfosにぶちこむ
            infos.AddRange(appendInfos);
        }

        // 残移動力が0以上(移動可能)なマスの情報だけを返す
        return(infos.Where(x => x.amount >= 0).ToArray());
    }
예제 #13
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="calculationMode"></param>
        public void FrameMove(CalculationMode calculationMode)
        {
            switch (calculationMode)
            {
                case CalculationMode.None:
                    FrameMoveNone();
                    break;

                case CalculationMode.SimpleApproximated:
                    FrameMoveSimpleApproximated();
                    break;

                case CalculationMode.SectorApproximated:
                    FrameMoveSectorApproximated();
                    break;

                case CalculationMode.Scientific:
                    FrameMoveScientific();
                    break;
            }
        }
예제 #14
0
 public CalculateAction(CalculationStack stack, CalculationMode mode)
 {
     this.stack = stack;
     this.mode  = mode;
 }
예제 #15
0
        public static double PortfolioAlpha(CalculationMode mode)
        {
            string tempPath = Config.STAT_PATH_DEFAULT + @"\" + Model_ViewPortfolio.list[0].stockCode + ".xml";
            Statistic tempStat = (Statistic)XMLHelper.ObjectFromXML(tempPath, typeof(Statistic));
            Tbill tbill = XMLHelper.TbillFromXML(Config.TBILL_PATH_DEFAULT + @"\2.xml");
            double riskPrem = (tempStat.annualReturn - tempStat.alpha - tbill.ytm) / 100 / tempStat.beta;

            return PortfolioReturn(mode) - tbill.ytm / 100 - PortfolioBeta(mode) * riskPrem;
        }
예제 #16
0
        public static double PortfolioReturn(CalculationMode mode)
        {
            double toReturn = 0.0;

            foreach (Model_ViewPortfolio eachPortfolioElm in list)
            {
                string eachPath = Config.STAT_PATH_DEFAULT + @"\" + eachPortfolioElm.stockCode + ".xml";
                Statistic eachStat = (Statistic)XMLHelper.ObjectFromXML(eachPath, typeof(Statistic));

                if (mode == CalculationMode.CURRENT)
                {
                    toReturn += eachStat.annualReturn / 100 * eachPortfolioElm.contributionToPortfolio / 100;
                }
                else
                {
                    toReturn += eachStat.annualReturn / 100 * double.Parse(eachPortfolioElm.optimalToPortfolio) / 100;
                }
            }

            return toReturn;
        }
예제 #17
0
    /// <summary>
    /// 移動可能なマスをハイライトします
    /// </summary>
    /// <param name="x">The x coordinate.</param>
    /// <param name="y">The y coordinate.</param>
    /// <param name="moveAmount">Move amount.</param>
    public void HighlightMovableCells(int x, int y, int moveAmount, Weapon equipWeapon, CalculationMode mode)
    {
        //まず移動可能なセルのハイライトを消す
        ResetMovableCells();

        //200724 渡された座標が最初のセルとなる
        //FirstはNullが返って来ない物に使うこと
        Main_Cell startCell = cells.First(c => c.X == x && c.Y == y);

        MoveAmountInfo[] moveableInfo = GetRemainingMoveAmountInfos(startCell, moveAmount, mode);
        foreach (var info in moveableInfo)
        {
            //移動可能にしていく trueになるとハイライトが青になる
            cells.First(c => c.X == info.coordinate.x && c.Y == info.coordinate.y).IsMovable = true;
        }

        //210219 先に移動可能か確認ループしてからでないと移動可能かどうかは分からないので2回ループ・・・
        foreach (var info in moveableInfo)
        {
            //210219 攻撃可能範囲の表示を追加
            if (equipWeapon != null)
            {
                Main_Cell attackCell = cells.First(c => c.X == info.coordinate.x && c.Y == info.coordinate.y);
                foreach (var Attackinfo in GetAttackRenge(attackCell, equipWeapon.range, equipWeapon.isCloseAttack))
                {
                    //攻撃可能にしていく trueになるとハイライトが赤になる
                    Main_Cell attackableCell = cells.First(c => c.X == Attackinfo.coordinate.x && c.Y == Attackinfo.coordinate.y);
                    if (attackableCell != null)
                    {
                        if (attackableCell.IsMovable == false)
                        {
                            attackableCell.IsAttackable = true;
                        }
                    }
                }
            }
        }
    }
예제 #18
0
 public static double PortfolioSharpe(CalculationMode mode)
 {
     try
     {
         Tbill tbill = XMLHelper.TbillFromXML(Config.TBILL_PATH_DEFAULT + @"\2.xml");
         return (PortfolioReturn(mode) - tbill.ytm / 100) / PortfolioVolatility(mode);
     }
     catch (Exception ex)
     {
         LogHelper.GetLogger(typeof(MainForm)).FullLog(ex.ToString(), "IGNORE");
         return 0.0;
     }
 }
예제 #19
0
        public void createDGElements(int numberOfDGElements, int polynomOrder, double leftBoundary, double rightBoundary, int systemDimension)
        {
            calcMode = CalculationMode.Stone;
            myTask = Task.TaskTwo;

            this.polynomOrder = polynomOrder;
            this.systemDimension = systemDimension;
            spaceLengthInElements = (rightBoundary - leftBoundary) / (double)numberOfDGElements;
            elements = new DGSystemElement[numberOfDGElements];
            for (int i = 0; i < numberOfDGElements; i++)
            {
                double leftSpaceBorder = leftBoundary + (double)i * (rightBoundary - leftBoundary) / (double)numberOfDGElements;
                double rightSpaceBorder = leftBoundary + (double)(i + 1) * (rightBoundary - leftBoundary) / (double)numberOfDGElements;

                if (myTask ==Task.TaskOne)
                    elements[i] = new DGSystemElement(DGMODE.STRONG, calcMode, leftSpaceBorder, rightSpaceBorder, polynomOrder,systemDimension, NumFlux, InhomogenuousPart, FluxFunction, InitialFunction);
                else if(myTask == Task.TaskTwo)
                    elements[i] = new DGSystemElement(DGMODE.ECON, calcMode,leftSpaceBorder, rightSpaceBorder, polynomOrder, systemDimension, NumFluxECON, InhomogenuousPart, FluxFunction, InitialFunction);
                else if(myTask == Task.TaskThree)
                    elements[i] = new DGSystemElement(DGMODE.ECON, calcMode, leftSpaceBorder, rightSpaceBorder, polynomOrder, systemDimension, NumFluxES, InhomogenuousPart, FluxFunction, InitialFunction);

                if (i > 0)
                {
                    elements[i].LeftNeighbour = elements[i - 1];
                    elements[i - 1].RightNeighbour = elements[i];
                }
            }

            if (calcMode != CalculationMode.Stone)
            {   //Periodic Boundary Condition
                if (numberOfDGElements > 1)
                {
                    elements[0].LeftNeighbour = elements[numberOfDGElements - 1];
                    elements[numberOfDGElements - 1].RightNeighbour = elements[0];
                }
                else
                {
                    elements[0].LeftNeighbour = elements[0];
                    elements[0].RightNeighbour = elements[0];
                }
            }
            else
            {
                //Dirichlet
                DGSystemElement dummy = new DGSystemElement(DGMODE.ECON, calcMode, 0.0, 0.0, polynomOrder, systemDimension, NumFluxES, InhomogenuousPart, FluxFunction, InitialFunction);
                Vector leftDirichletBoundary = new Vector(2);
                leftDirichletBoundary[0] = 1.1;
                leftDirichletBoundary[1] = leftDirichletBoundary[0] * -0.525;

                Vector rightDirichletBoundary = new Vector(2);
                rightDirichletBoundary[0] = 1.1;
                rightDirichletBoundary[1] = rightDirichletBoundary[0] * 0.525;

                dummy.RightBoarderValue = leftDirichletBoundary;
                dummy.LeftBoarderValue = rightDirichletBoundary;

                elements[0].LeftNeighbour = dummy;
                elements[numberOfDGElements - 1].RightNeighbour = dummy;
            }
        }
예제 #20
0
 public ColdBoundaryForm(Class1Boundary _boundary, CalculationMode _mode)
 {
     InitializeComponent();
     Boundary = _boundary;
     Mode     = _mode;
 }
예제 #21
0
        public static Operation Build(CalculationStack stack, CalculationMode mode, OperationType type)
        {
            // Zacznij od sprawdzania operacji ktore sa niezalezne od trybu
            switch (type)
            {
                case OperationType.C:
                        return new Erase(stack);
                case OperationType.AC:
                        return new Clear(stack);
                case OperationType.ENTER:
                        return new Enter(stack);
                case OperationType.POP:
                        return new Pop(stack);
                case OperationType.SWAP:
                        return new Swap(stack);
                case OperationType.MC:
                        return new MemoryClear(stack);
                case OperationType.MR:
                        return new MemoryRecall(stack);
                case OperationType.Mplus:
                        return new MemoryPlus(stack);
                case OperationType.Mminus:
                        return new MemoryMinus(stack);
            }

            if (mode == CalculationMode.Date) {
                switch (type)
                {
                    case OperationType.SUB:
                        return new SubDate(stack);
                    case OperationType.ADD:
                        return new AddDate(stack);
                }
            }

            if (mode == CalculationMode.Time)
            {
                switch (type)
                {
                    case OperationType.SUB:
                        return new SubTime(stack);
                    case OperationType.ADD:
                        return new AddTime(stack);
                }
            }

            switch (type)
            {
                case OperationType.SQRT:
                    return new SqrtNumber(stack);
                case OperationType.POW:
                    return new PowerNumber(stack);
                case OperationType.INV_X:
                    return new InvertNumber(stack);
                case OperationType.PLUS_MINUS:
                    return new ChangeSign(stack);
                case OperationType.PERCENT:
                    return new PercentNumber(stack);
                case OperationType.DIV:
                    return new DivNumber(stack);
                case OperationType.MUL:
                    return new MulNumber(stack);
                case OperationType.SUB:
                    return new SubNumber(stack);
                case OperationType.ADD:
                    return new AddNumber(stack);
            }

            return null;
        }
예제 #22
0
 public CalculateAction(CalculationStack stack, CalculationMode mode)
 {
     this.stack = stack;
     this.mode = mode;
 }
예제 #23
0
 public static void UpdateCalculationMode()
 {
     switch (Properties.GeneralSettings.Default.ProcEffectMode)
     {
         case 0:
             Mode = CalculationMode.Simple;
             break;
         case 1:
             Mode = CalculationMode.Advanced;
             SpecialFunction.MACHEP = 5.9604645E-8;
             break;
         case 2:
             Mode = CalculationMode.Advanced;
             SpecialFunction.MACHEP = 1.11022302462515654042E-16;
             break;
         case 3:
             Mode = CalculationMode.Interpolation;
             SpecialFunction.MACHEP = 1.11022302462515654042E-16;
             break;
     }
 }
예제 #24
0
        public static double PortfolioVolatility(CalculationMode mode)
        {
            List<Portfolio> selectedStockList = new List<Portfolio>();
            List<Tick>[] ticksList = new List<Tick>[list.Count];
            double[] valueOfStockList = new double[list.Count];

            for (int i = 0; i < list.Count; i++)
            {
                selectedStockList.Add(list[i].getPrimitive());
                string eachPath = Config.STOCK_PATH_DEFAULT + @"\" + list[i].stockCode + ".xml";
                Stock eachStock = XMLHelper.StockFromXML(eachPath);
                ticksList[i] = eachStock.priceList;

                if (mode == CalculationMode.CURRENT)
                {
                    valueOfStockList[i] = list[i].contributionToPortfolio;
                }
                else
                {
                    valueOfStockList[i] = double.Parse(list[i].optimalToPortfolio);
                }
            }

            return StatHelper.GetPortfolioSD(selectedStockList,
                valueOfStockList, 100, StatHelper.GetCovarianceMatrix(ticksList));
        }
예제 #25
0
    /// <summary>
    /// 移動経路となるマスを返します
    /// </summary>
    /// <returns>The route cells.</returns>
    /// <param name="startCell">Start cell.</param>
    /// <param name="moveAmount">Move amount.</param>
    /// <param name="endCell">End cell.</param>
    /// //endCellは移動先のセルらしい
    public Main_Cell[] CalculateRouteCells(int x, int y, int moveAmount, Main_Cell endCell, CalculationMode mode)
    {
        //x,yを元に移動開始するセルを取得
        var startCell = cells.First(c => c.X == x && c.Y == y);

        //移動可能となるセルリストがMoveAmountInfo型で返ってくる
        var moveAbleInfos = GetRemainingMoveAmountInfos(startCell, moveAmount, mode);

        //移動経路のセルリスト作る
        List <Main_Cell> routeCells = new List <Main_Cell>();

        Debug.Log($"移動経路計算モード =  {mode}");

        //攻撃モードと探索モードだと検索方法が違う
        if (mode == CalculationMode.ENEMY_MOVE || mode == CalculationMode.PLAYER_MOVE)
        {
            Debug.Log("移動先への最短距離を検索");
            //移動可能リストにクリックした移動先のセルが入ってなかったらおかしいのでエラー
            if (!moveAbleInfos.Any(info => info.coordinate.x == endCell.X && info.coordinate.y == endCell.Y))
            {
                Debug.Log(string.Format("endCell(x:{0}, y:{1}) is not movable.", endCell.X, endCell.Y));
                throw new ArgumentException(string.Format("endCell(x:{0}, y:{1}) is not movable.", endCell.X, endCell.Y));
            }

            //まず最終移動先セルを追加
            routeCells.Add(endCell);
            //無限ループ
            while (true)
            {
                //まず最終移動先セルの情報から開始 配列は0スタートでCountは要素数を返すので-1する
                var currentCellInfo = moveAbleInfos.First(moveAbleInfo => moveAbleInfo.coordinate.x == routeCells[routeCells.Count - 1].X && moveAbleInfo.coordinate.y == routeCells[routeCells.Count - 1].Y);

                //現在のセルを現在のセル情報(MoveAmountInfo)から取得する
                var currentCell = cells.First(cell => cell.X == currentCellInfo.coordinate.x && cell.Y == currentCellInfo.coordinate.y);

                //1つ前のセルの移動力を算出 当然0から始まる
                var previousMoveAmount = currentCellInfo.amount + currentCell.Cost;

                //1つ前のセルの中から、移動力が同じ物を探す
                //ABS : 絶対値を返すので、X方向、Y方向だろうが1なら隣接しているセルとなる
                var previousCellInfo = moveAbleInfos.FirstOrDefault(moveAbleInfo => (Mathf.Abs(moveAbleInfo.coordinate.x - currentCell.X) + Mathf.Abs(moveAbleInfo.coordinate.y - currentCell.Y)) == 1 && moveAbleInfo.amount == previousMoveAmount);

                //最終的にはプレイヤーが今居る座標の移動力になり、最大移動力以上のセルは存在しないのでnullとなる
                if (null == previousCellInfo)
                {
                    break;
                }
                //移動経路リストに最短経路を追加する
                routeCells.Add(cells.First(c => c.X == previousCellInfo.coordinate.x && c.Y == previousCellInfo.coordinate.y));
            }
        }

        //最終目的地から追加していってるので順番を逆にする
        routeCells.Reverse();

        //配列で返す
        return(routeCells.ToArray());
    }