Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your task is to write a Python program that uses recursion to generate pseudo-random art in a Mondrian style. Your programs output will be a

Your task is to write a Python program that uses recursion to generate pseudo-random art in a Mondrian style. Your programs output will be a tkinter canvas that contains the image you created. The following general strategy will be used to generate art in a Mondrian style:

If the region is wider than half the initial canvas size and the region is taller than half the initial canvas height:

Use recursion to split the region into 4 smaller regions (a vertical split and a horizontal

split) with both split locations chosen randomly. Else if the region is wider than half the initial canvas size:

Use recursion to split the region into 2 smaller regions using a vertical line with the split

location chosen randomly. Else if the region is taller than half the initial canvas size:

Use recursion to split the region into 2 smaller regions using a horizontal line with the

split location chosen randomly. Else if the region is big enough to split both horizontally and vertically, and both a horizontal and

vertical split are randomly selected: Use recursion to split the region into 4 smaller regions (a vertical split and a horizontal split) with both split locations chosen randomly.

Else if the region is wide enough to split horizontally, and a horizontal split is randomly selected: Use recursion to split the region into 2 smaller regions using a vertical line with the split location chosen randomly.

Else if the region is tall enough to split vertically, a vertical split is randomly selected: Use recursion to split the region into 2 smaller regions using a horizontal line with the split location chosen randomly.

Else: Fill the current region (randomly, either white or colored, and if colored, with a random determination of red, blue or yellow).

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

Recommended Textbook for

Practical Database Programming With Visual Basic.NET

Authors: Ying Bai

1st Edition

0521712351, 978-0521712354

More Books

Students also viewed these Databases questions

Question

3. What kind of company culture is created by this focus?

Answered: 1 week ago