Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Follow these instructions and make a picture. You must execute this recursive procedure. (To avoid a trivial result, you have to call the function at

Follow these instructions and make a picture.

You must execute this recursive procedure.

(To avoid a trivial result, you have to call

the function at least ten times.)

Start with an empty rectangle

Execute this function...

SplitOrDraw( rectnagle )

For each rectangle...

Randomly choose: split or not

If you choose to split

Randomly choose: horizontal or vertical

If you choose horizontal

Randomly choose y for the split

SplitOrDraw( top half )

SplitOrDraw( bottom half )

If you choose vertical

Randomly choose x for the split

SplitOrDraw( left half )

SplitOrDraw( right half )

If you choose to not split

Randomly choose: fill or empty

if you choose to fill

Draw a filled rectnagle

if you choose empty

Leave it empty (do nothing)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions