Practice Problems

Here are some practice problems to polish what you’ve learnt so far. Try to solve as many of them as possible.

Write a program that draws the following sketches.

Problem 5.1

Problem 1

Problem 5.2

Problem 2

Problem 5.3

Problem 3

Problem 5.4

Problem 4

Problem 5.5

Problem 5

Problem 5.6

Problem 6

Problem 5.7

Problem 7

Problem 5.8

Problem 4

Problem 5.9

Problem 9

Problem 5.10

Problem 10

Problem 5.11

Problem 11

Problem 5.12

Problem 12

Problem 5.13

Problem 13

Problem 5.14 Write a program to draw one of the diagonals in random for each cell in a grid. For example, if you take a 2x2 grid, you would get something like the figure below.

Problem 14 2x2

If you take a 16x16 grid, you’ll should get a beatiful maze like this one.

Problem 14

It is not as complex as it sounds. Give it a try.

Please note that the grid in the background was drawn for illustration and you don’t need to draw that.

Problem 5.15

Problem 15

Problem 5.16

Problem 16

Problem 5.17

Problem 17

Problem 5.18

Problem 18

Problem 5.19 Every third shape is a square.

Problem 19

Problem 5.20 Alternating cirle, square and diamonds.

Problem 20