private static bool CalculateMyMoveDepth(Point startPoint, int depth, List <Command> commands)
        {
            if (depth > AppSettings.MyMovePredictionDepth)
            {
                return(false);
            }

            var isNextDepthAdded = false;

            foreach (var direction in BaseMobile.ValidDirections)
            {
                var point = startPoint.Shift(direction);
                var cell  = Field.GetCell(point);

                if (IsSafeMoveNotVisitedCell(cell, depth))
                {
                    var currentCommands = commands.ToList();
                    currentCommands.Add(new Command(direction));

                    var nextDepthPrediction = (MyMovePrediction)cell.AddPrediction(depth, PredictionType.MyMove, currentCommands);
                    Field.AddMyMoveDepthPredictions(depth, nextDepthPrediction);

                    isNextDepthAdded = true;


                    CalculateMyShotPredictions(cell.Point, direction, currentCommands);
                }
            }

            return(isNextDepthAdded);
        }
Beispiel #2
0
        private static bool CalculateMyMoveDepth(Point startPoint, int depth, List <Direction> command)
        {
            if (depth > AppSettings.MyMovePredictionDepth)
            {
                return(false);
            }

            var isNextDepthAdded = false;

            AppendLog($"DEPTH: {depth}, POINT: {startPoint}");

            foreach (var direction in BaseMobile.ValidDirections)
            {
                var point = startPoint.Shift(direction);
                var cell  = Field.GetCell(point);

                if (IsSafeMoveNotVisitedCell(cell, depth))
                {
                    var currentCommand = command.ToList();
                    currentCommand.Add(direction);

                    var nextDepthPrediction = (MyMovePrediction)cell.AddPrediction(depth, PredictionType.MyMove, currentCommand);
                    Field.AddMyMoveDepthPredictions(depth, nextDepthPrediction);

                    AppendLog($"COMMAND: {nextDepthPrediction.CommandsText}");
                    isNextDepthAdded = true;


                    CalculateMyShotPredictions(cell.Point, direction, currentCommand);
                }
            }

            return(isNextDepthAdded);
        }