示例#1
0
        public bool PredictRotate(Board board, Move move)
        {
            // rotation 90 deg.
            Board rotatedBoard = board.Rotate90Deg();

            if (rotatedBoard.ToString().Equals(move.BoardBeforeMove.ToString()))
            {
                Position predictedPosition = move.MoveMade.rotate90Deg().rotate90Deg().rotate90Deg();
                PredictionsByKnownAfterRotation[predictedPosition.R, predictedPosition.C] += PREDICTION_AFTER_ROTATION_WEIGHT;

                return(true);
            }

            // rotation 180 deg.
            rotatedBoard = rotatedBoard.Rotate90Deg();

            if (rotatedBoard.ToString().Equals(move.BoardBeforeMove.ToString()))
            {
                Position predictedPosition = move.MoveMade.rotate90Deg().rotate90Deg();
                PredictionsByKnownAfterRotation[predictedPosition.R, predictedPosition.C] += PREDICTION_AFTER_ROTATION_WEIGHT;
                return(true);
            }

            // rotation 270 deg.
            rotatedBoard = rotatedBoard.Rotate90Deg();

            if (rotatedBoard.ToString().Equals(move.BoardBeforeMove.ToString()))
            {
                Position predictedPosition = move.MoveMade.rotate90Deg();
                PredictionsByKnownAfterRotation[predictedPosition.R, predictedPosition.C] += PREDICTION_AFTER_ROTATION_WEIGHT;
                //PredictionsByKnownAfterRotation[move.MoveMade.C, 14 - move.MoveMade.R]++;
                return(true);
            }

            return(false);
        }