Ejemplo n.º 1
0
        private static int GoDeeper(Board currentBoard, int srcX, int srcY, int dstX, int dstY, int level, int highestValue)
        {
            int[] move = new int[] { srcX, srcY, dstX, dstY };
            int[] arr;
            Board tempBoard = new Board();

            tempBoard.Copy(currentBoard);

            if (tempBoard.UpdateBoard(srcX, srcY, dstX, dstY))
            {
                if (EvaluateBoard(tempBoard) < highestValue)
                {
                    return(DONE);
                }
                else
                if (EvaluateBoard(tempBoard) < 9000 || EvaluateBoard(tempBoard) > -1000)
                {
                    arr = MakeTurn(tempBoard, level + 1);
                    tempBoard.UpdateBoard(arr[0], arr[1], arr[2], arr[3]);
                    return(EvaluateBoard(tempBoard));
                }
                else
                {
                    return(EvaluateBoard(tempBoard));
                }
            }

            return(DONE);
        }
Ejemplo n.º 2
0
        private static int EvaluateMove(Board currentBoard, int srcX, int srcY, int dstX, int dstY, int level)
        {
            Board tempBoard = new Board();

            tempBoard.Copy(currentBoard);
            if (tempBoard.UpdateBoard(srcX, srcY, dstX, dstY))
            {
                return(EvaluateBoard(tempBoard));
            }
            return(DONE);
        }
Ejemplo n.º 3
0
        private static int GoDeeper(Board currentBoard, int srcX, int srcY, int dstX, int dstY, int level, int highestValue)
        {
            int[] move = new int[]{srcX, srcY, dstX, dstY};
            int[] arr;
            Board tempBoard = new Board();
            tempBoard.Copy(currentBoard);

            if (tempBoard.UpdateBoard(srcX, srcY, dstX, dstY)) {
                if (EvaluateBoard(tempBoard) < highestValue)
                    return DONE;
                else
                    if (EvaluateBoard(tempBoard) < 9000 || EvaluateBoard(tempBoard) > -1000) {
                        arr = MakeTurn(tempBoard, level + 1);
                        tempBoard.UpdateBoard(arr[0], arr[1], arr[2], arr[3]);
                        return EvaluateBoard(tempBoard);
                    }
                    else
                        return EvaluateBoard(tempBoard);
            }

            return DONE;
        }
Ejemplo n.º 4
0
 private static int EvaluateMove(Board currentBoard, int srcX, int srcY, int dstX, int dstY, int level)
 {
     Board tempBoard = new Board();
     tempBoard.Copy(currentBoard);
     if (tempBoard.UpdateBoard(srcX, srcY, dstX, dstY))
         return EvaluateBoard(tempBoard);
     return DONE;
 }