public Tile algoMinMax(Tile[][] currentGameBoard2) {


		System.out.println("I am min max called");

		Node root = new Node();

		GameTree gameTree = new GameTree();
		GameBoard minmaxboard = new GameBoard();
		minmaxboard.GameBoardinitialize(8);
		Tile [][]currentGameBoard = minmaxboard.getGameBoard();
		System.out.println("min max****************************************");
		for (int w = 0; w< currentGameBoard2.length; w++) {
			for (int q = 0; q < currentGameBoard2.length; q++) {
				System.out.print(" "+ currentGameBoard2[w][q].getPegValue() );
			}
			System.out.println();
		}
	
		for (int w = 0; w< currentGameBoard2.length; w++) {
			for (int q = 0; q < currentGameBoard2.length; q++) {
				currentGameBoard[w][q].setPegValue(currentGameBoard2[w][q].getPegValue());
			}
		}
		
		root = gameTree.genGameTree(currentGameBoard, 3);
		
		
		int minWeight;
		int maxWeight;
		Node node, tempnode;
		
		if(!(root.getChildren() == null)){
		for (int i = 0; i < root.getChildren().length; i++) {
			node = root.getChildren()[i];
			int randomNum2 = 5 + (int)(Math.random()* 50);
			if(!(node.getChildren() == null)){
			for (int j = 0; j < node.getChildren().length; j++) {
				
				int randomNum = 5 + (int)(Math.random()* 50);
				//System.out.println(randomNum + "minmaxrandom");
				tempnode = node.getChildren()[j];
				
				tempnode.setWeight(randomNum);
				//System.out.println(tempnode.getWeight()+ "weight of each node");
				root.getChildren()[i].getChildren()[j].setWeight(randomNum);
				
				//tempnode.setWeight(gameTree.Utility(tempnode.getBoardState()));
			}
		}
			root.getChildren()[i].setWeight(randomNum2);
		}
		root.setWeight(8888);
		}
		// MIN TURN
		for (int i = 0; i < root.getChildren().length; i++) {
			minWeight = minWeight(root.getChildren()[i]);
			root.getChildren()[i].setWeight(minWeight);
		}

		// MAX TURN ROOT WEIGHT

		maxWeight = maxWeight(root);
		root.setWeight(maxWeight);
		System.out.println(finalMove.getRowIndex()+ "***********" + finalMove.getColIndex());
		return finalMove;
	}