drawing exercise: polygons

Introduction
Now being familiar with points and lines, while not try to make exercises upon polygons? As an example we'll create an exercise in which one has to draw a rectangle with random generated perimeter. Interesting is that a pupil can try to find several solutions. Alternatively you can set free just one of the two dimensions of the rectangle. And once familiar with rectangles you can do the same with other polygons.
How to do this?
[list][*][b]solution: [/b]Define a number [code]sol = 2RandomBetween(3, 25)[/code] as an even number.[/*][*][b]Point in rectangle[/b]: Create:[br]- a rectangle [code]poly1 = Polygon((0, 0), (22, 0), (22, 8), (0, 8))[/code][br]- a point [code]P = PointIn(poly1)[/code] to be moved Fixed to Grid in this rectangle[/*][*][b]answer[/b]: create a rectangle [code]ans = Polygon((0, 0), (x(P), 0), (x(P), y(P)), (0, y(P)))[/code][/*][*][b]control[/b]: Control of the answer is made by dynamic coloring of the rectangle ans.[br]- Create a variable [code]test= 2 (x(P) + y(P)) ≟ sol[/code][br]- Red: [code]If(submit ≟ 1 ∧ test ≟ false, 1, 0)[/code][br]- Green: [code]If(submit ≟ 1 ∧ test, 0.7, 0)[/code][br]- Blue: [code]0[/code][/*][/list]

Information: drawing exercise: polygons