English translation

This task includes automated tests. The solution is accepted only if all tests pass. See navodila za poganjanje testov.

The task is related to the previous two tasks, and mostly requires packing the existing code into functions. You may even use the published solutions if you will.

Write the following functions:

  • stevilo_ovir(ovire) gets a list of triplets (x0, x1, y) representing obstacles, and returns the number of obstacles.
  • dolzina_ovir(ovire) returns the total length of obstacles
  • sirina(ovire) returns the width of the path, that is, the largest x-coordinate that appears in the list of obstacles
  • pretvori_vrstico(vrstica) gets a row as string of hashes and dots, and returns a list of pairs (x0, x1) representing the positions of obstacles (the warm-up task from the previous week)
  • dodaj_vrstico(bloki, y) gets a list of pairs, such as the one returned by the previous function and row number y, and returns a list of triplets in which y is appended to each of the paris. Call dodaj_vrstico([(3, 4), (6, 8), (11, 11)], 3) returns [(3, 4, 3), (6, 8, 3), (11, 11, 3)].
  • pretvori_zemljevid(zemljevid) gets a map represented by list of strings, and returns a list of triplets representing obstacles (mandatory task from the previous week). The function must properly use the previous two function. (Tests will ensure that by temporarily replacing your two functions with functions giving some wrong results and then verify that results returned by this function are "correctly wrong").
  • globina(ovire, x) gets a list of obstacles and column number and returns the row with the first obstacle in that column. (Task from two weeks ago.) If there is no obstacle in that column, the function must return None.
  • naj_stolpec(ovire) returns the column in which the cyclist can go the furthest, and the row at which she stops. If there are no obstacles in some column, it returns that column and None. (Additional task from two weeks ago.)
  • senca(ovire) returns a list whose elements, False and True correspond to columns and tell whether that particular column is blocked or not. If there are 5 columns and the second and the last are unblocked, the function returns [False, True, False, False, True].
Zadnja sprememba: sreda, 9. november 2022, 17.15