1 answer

Need assistance with small piece of larger assignment writing a recursive division algorithm (Java).

The assignment is to write a recursive division algorithm to build a maze in a 2D array.

I have code that will randomly generate vertical and horizontal walls and randomly place doorways in the walls.

**Requirements**:

The maze should be broken into sub-regions on each recursive method call until the sub-region is no less than 3x3.

My recursive calls only seem to work on the top left sub-region of each call and I can't seem to get it to work on every sub-region in the entire maze board.

**Outline of my code:**

1) BASE CASE - If the width of sub region is less than 3 and height of a sub-region is less than 3 (smaller than 3x3), do not run recursive method again. {

(below code is inside base case if statement)

variable X = randomly select a x value for vertical wall in the range of left boundary to right boundary

variable Y = randomly select a y value for horizontal wall in range of top boundary to bottom boundary

for loop to build vertical wall

randomly place passage somewhere along vertical wall

for loop to build horizontal wall

randomly place passage on horizontal wall LEFT of vertical wall

randomly place passage on horizontal wall RIGHT of vertical wall

run recursive method

}

**Thoughts**:

Should one recursive method call go inside of the base case if statement, then another call outside of it? How can I ensure EVERY sub-region greater than 3x3 is being divided to the base case.

1 answer
#####
.CO Question 13 of 14 A Lewis structure with placeholder elements is shown below. If the...

.CO Question 13 of 14 A Lewis structure with placeholder elements is shown below. If the formal charge of the central atom is 0, choose the possible identities of the central atom. A) B or AI B) O, S, or Se C) F, CI, Br, or D) Por As = E) S or Se...

1 answer
#####
O GASES Calculating mole fraction in a gas mixture A 8.00 L tank at 19.8 °C...

O GASES Calculating mole fraction in a gas mixture A 8.00 L tank at 19.8 °C is filled with 11.0 g of chlorine pentafluoride gas and 7.97 g of boron trifluoride gas. You can assume both gases behave as ideal gases under these conditions. Calculate the mole fraction of each gas. Be sure each of yo...

1 answer
#####
A ball is selected from an box containing two black balls, numbered 1 and 2, and...

A ball is selected from an box containing two black balls, numbered 1 and 2, and two white balls, numbered 3 and 4. Let the events A, B, and Cbe defined as follows: A-b). (2, b)3. "black ball selected": B (2.b). (4,w)), "even-numbered ball selected": and (3, w). (4, w)). "number ...

1 answer
#####
I need help with questions 11 & 12 please. D Question 11 1 pts A study...

I need help with questions 11 & 12 please. D Question 11 1 pts A study reports the following final notation: F(2, 37) = 9.00,p<.05; how many total participants were involved in the study? O 37 O 38 O 39 о 40 Question 12 1 pts A study reports the following final notation: F(2, 37) - 9.0...

1 answer
#####
To test whether it’s reasonable to assume equal variances, you could do an F test as in the...

A sample of 25 concession stand purchases at the October 22 matinee of Bride of Chucky showed a mean purchase of $5.29 with a standard deviation of $3.02. For theOctober 26 evening showing of the same movie, for a sample of 25 purchases the mean was $5.12 with a standard deviation of $1.98. The mean...

1 answer
#####
Use quadratic formula to solve equation 0=x^2+x-20

use quadratic formula to solve equation 0=x^2+x-20...

1 answer
#####
In October a trader enters into a single long December wheat futures contract at $5.10/bushel. In...

In October a trader enters into a single long December wheat futures contract at $5.10/bushel. In November the trader offset (or closed) their position when the price of wheat on that December contract was $4.98/bushel. What is the trader's gain or loss (in S/bushel) from these transactions? You...

1 answer
#####
Solve the system by using Gaussian elimination or Gauss-Jordan elimination. -- 5x+12y + 5z = -55...

Solve the system by using Gaussian elimination or Gauss-Jordan elimination. -- 5x+12y + 5z = -55 x-2y +3z = 14 -5x +3y – 2z = -22 The solution set is {000}:...

1 answer
#####
Discount-Mart isues $18 million in bonds on January 1, 2021. The bonds have a ten-year term...

Discount-Mart isues $18 million in bonds on January 1, 2021. The bonds have a ten-year term and pay interest semiannually on June 30 and December 31 each year. Below is a partial bond amortization schedule for the bonds: Interest Increase in Carrying Value Date e1/01/2021 Cash Paid Expense Carrying ...

1 answer
#####
Required information Problem 6-1A Perpetual: Alternative cost flows LO P1 [The following information applies...

Required information Problem 6-1A Perpetual: Alternative cost flows LO P1 [The following information applies to the questions displayed below.) Warnerwoods Company uses a perpetual inventory system. It entered into the following purchases and sale...

1 answer
#####
12,000 15,100 Given the following information for Jawa Corp. prepare a full cas full cash budget...

12,000 15,100 Given the following information for Jawa Corp. prepare a full cas full cash budget for the months of April, May, and June Feb Mar Apr May lune July Sales in Units 10,000 16,250 16,675 16,000 with a per unit cost All units are sold at a price of $24.75, with a per unit cost of $13.50. S...

1 answer
#####
In rho-dependent transcription termination: the formation of a hairpin in the transcribed mRNA causes RNA polymerase...

In rho-dependent transcription termination: the formation of a hairpin in the transcribed mRNA causes RNA polymerase to pause, facilitating termination. rho binds the mRNA, and when it makes contact with RNA polymerase, it assists with the removal of the mRNA from the DNA template. the rho factor bi...

1 answer
#####
E statement 11. Hedman Corporation has provides the followin Nowing information is within the relevant range...

e statement 11. Hedman Corporation has provides the followin Nowing information is within the relevant range g statement. Assume that has $ Sales (9,000 units) Variable expenses Contribution margin Fixed expenses Net operating income The margin of safety percentage is closest to: A) 7596 B) 196 270,...

1 answer
#####
Please show easy to follow work, thanks a lot! Question 1 (1 point) d The motion...

Please show easy to follow work, thanks a lot! Question 1 (1 point) d The motion of a particle is defined by the relationx- at 3-bt 2+ct + d, where x and t are expressed in meters and seconds, respectively, and a - 2.00, b- 9.00, c 4.00 and d 6.00 are constants. Determine the acceleration of the par...

1 answer
#####
TOTAL AREA pls 90 mm 20 mm 3 120 mm + 40 mm 20 mm 2...

TOTAL AREA pls 90 mm 20 mm 3 120 mm + 40 mm 20 mm 2 60 mm...

1 answer
#####
How would you prioritize these nursing diagnoses? What is the interrelationship between them (i.e. how does...

How would you prioritize these nursing diagnoses? What is the interrelationship between them (i.e. how does one influence the other)? It is for a patient with chronic osteomyelitis, diabetes mellitus type 1, and who is going for a toe amputation. 1. impaired physical mobility R/T loss of a toe. 2. r...

1 answer
#####
Derive the Boolean expression of a combination logic from the following truth table, where A, B,...

Derive the Boolean expression of a combination logic from the following truth table, where A, B, C are input variables and D is output. Draw the circuit diagram to implement it. Show your working steps. The full subtractor is a combinational circuit, which is used to perform subtraction of three inp...

1 answer
#####
A ball with a mass of #4 kg # and velocity of #2 m/s# collides with a second ball with a mass of #2 kg# and velocity of #- 4 m/s#. If #20%# of the kinetic energy is lost, what are the final velocities of the balls?

A ball with a mass of #4 kg # and velocity of #2 m/s# collides with a second ball with a mass of #2 kg# and velocity of #- 4 m/s#. If #20%# of the kinetic energy is lost, what are the final velocities of the balls?...