public bool PredictShift(Board board, Move move) { // shift for (int shiftR = MIN_SHIFT; shiftR <= MAX_SHIFT; shiftR++) { for (int shiftC = MIN_SHIFT; shiftC <= MAX_SHIFT; shiftC++) { Board boardBeforeMoveAfterShift = move.BoardBeforeMove.Shift(shiftR, shiftC); if (boardBeforeMoveAfterShift != null) { if (boardBeforeMoveAfterShift.ToString().Equals(board.ToString())) { int destinyR = move.MoveMade.R + shiftR; int destinyC = move.MoveMade.C + shiftC; if (Board.IsCoordinateOK(destinyR) && Board.IsCoordinateOK(destinyC)) { PredictionsByKnownAfterShift[destinyR, destinyC] += PREDICTION_AFTER_SHIFT_WEIGHT; } } } } } return(false); }
public bool PredictStrinct(Board board, Move move) { Console.WriteLine("I will check move no " + move.MoveNo); if (move.BoardBeforeMove.ToString().Equals(board.ToString())) { PredictionsByKnownStrinct[move.MoveMade.R, move.MoveMade.C] += PREDICTION_STRINCT_WEIGHT; return(true); } return(false); }
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); }