Logo
Competition tasks for the programming language LOGO often involve drawing rectangles on the screen. Drawing in LOGO is done by moving a turtle.shaped cursor.The turtle is defined by its position and angle. It holds in its mouth a pencil that can be raised or lowered. When the pencil is lowered, moving the turtle causes the pencil to leave a trail on the screen. The turtle is initially at coordinates (0,0) facing in the direction of increasing y coordinates, pencil lowered. We can manipulate the turtle with the following set of commands:
1. FD x – move the turtle x units forward.
2. LT α – turn the turtle α degrees counter.clockwise.
3. RT α – turn the turtle α degrees clockwise.
4. PU – raise the pencil.
5. PD – lower the pencil.
Your program will be given a set of rectangles (with sides parallel to coordinate axes) that need to be drawn on the screen. The turtle may go over the same segment with its pencil lowered multiple times, but it is not allowed to draw anything other than the given rectangles. Write a program that calculates the smallest number of times the pencil must be raised in order to draw all the rectangles.
< y2 ≤ 500) separated by a space. The points (x1, y1) and (x2, y2) are diagonally opposite corners of a rectangle.
1
0 0 10 10 Output:
01
-5 -5 5 5 Output:
1Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.