ARTICLE AD BOX
i posted earlier and i improved my code, but i have a real hard time for setting the recursive method at the end of my first division. can someone help me please ? this is my method for the division :
private void divide(int[][] mazeToBe,int width, int height, int difficulty){ if (chooseOrientation(width, height).equals("HORIZONTAL")){ int random = randomOdd(height); for (int i = 0; i < width; i++) { mazeToBe[random][i] = 1; } mazeToBe[random][randomEven(width-1)] = 0; height = height -random +1; //if(height > difficulty) divide(mazeToBe, width, height, difficulty); } if (chooseOrientation(width, height).equals("VERTICAL")){ int randomOdd = randomOdd(height-1); for (int i = 0; i < height; i++) { mazeToBe[i][randomOdd] = 1; } mazeToBe[randomEven(height-1)][randomOdd] = 0; width = width - randomOdd +1; //if(width > difficulty) divide(mazeToBe, width, height, difficulty); } }i realize i have a difficulty parameter i do not use. i have to use it as a base case, but i am not sure how
