Do you need help?

Notice Board

Per partecipare al corso di Fondamenti di programmazione 2021-22 loggatevi e attivatelo nella vostra pagina dei corsi preferiti. A quel punto il corso appare nel menù personale cliccando sul proprio avatar. Per i materiali degli anni precedenti seguite lo stesso metodo.

To join the Programming/Lab 2021-22 course, log-on and select it on the my courses page. It will appear on the personal menu of your avatar. For earlier years use the same method.



[HOMEWORK] Homework 6 recovery (deadline 5 days before the exam) [ZIP UPDATED 28/12]

andrea.sterbini (173640 points)
516 941 1795
in News by (174k points)
edited by


  • Corrections to the exercise text will be posted here
    • As noted in there it was a dungeon with a tile without the complete grey border. We have updated the images both in the ZIP file (RE DOWNLOAD IT) and in the VM.
    • The zip file contained some spurious file and the exercise text needed a couple of corrections.
    • As noted in the value to be returned must be in tje order (N, S E, W) instead than the (N, S, W, E) order that was stated in the previous ZIP version
    • I have updated the zip file, re-download it.
  • NOTICE: to disable some safety checks and the timeout, change by setting DEBUG=True


To complete the homework:

  • Install all the required libraries (INCLUDING stopit)
  • Download the file and unzip it in a directory
    • The archive contains:
      • a problem to be solved, described at the beginning of file;
        • your job is to complete the ex1 function inside to solve the problem – adding other functions is allowed;
      • all other libraries and test files needed to run tests on your machine.
  • Enter the directory created by unzipping the archive and
    • rename as and edit the file to solve the problem;
  • NOTICE: the program should not use input() or print(). All needed parameters are passed to the ex1 function by the test system. Your results are returned to the tests by using return.
  • BEWARE: global variables are forbidden.
  • BEWARE: it's forbidden to import other libraries apart from the ones already imported in the text.
  • NOTICE: your program should be applicable to any correct input (do not exploit data repetitions or particularities).
    • if __name__ == '__main__':
      • # Here you can enter your own test instructions
  • To test your program:
    • open an “Anaconda Prompt” window and enter the directory obtained by unzipping the file
    • run the following command
      • pytest -v -rA
    • or (test printing also a list of the slowest runs)
      • pytest -v -rA --durations 0
    • or (test printing a list of the 20 slowest functions executed)
      • pytest -v -rA --profile
    • To stop tests at the first error, add the -x option
    • If you use Spyder:
      • you can run tests from Spyder by first installing the spyder-unittest plugin (but you cannot add parameters to the test execution);
      • you can profile the functions from Spyder by first installing the spyder-line-profiler plugin.

NOTICE: to open and edit text files in the UTF8 format, DO NOT use Notepad (as it does not handle well the Unix linefeed character '\n'). Use Spyder or Notepad++ instead.

Deadline: 23:59 of 5 days before the exam date


You are required to submit ONLY the file
To do so, go to page and submit the file.
After some minutes/hours, the homework leaderboard will be updated with your tests results, conducted in a standardized virtual machine.
You can submit your program more than once. The latest submission is the one that counts.

2 Answers

Lexyo (800 points)
1 2 5
by (800 points)
I have a doubt, in some images you have some doors that are with a black line inside and others that have not this lines and are just brown... are they just open doors? how should we interpretate them?
mjijena (280 points)
1 3 7
by (280 points)
You should interpret them as the same thing, They have different designs but both work in the same way. (It was said on the Italian forum)
angelo.spognardi (4720 points)
37 65 99
by (4.7k points)
There are just two different images of a door, but the color is the same and you should handle them in the same manner: as doors.
Fran.Cie. (210 points)
0 0 1
by (210 points)
What does an error "The import of 'unicodedata' is forbidden" mean? I didn't import any additional libraries except "random" and "images", and despite I don't pass any test? Why?
angelo.spognardi (4720 points)
37 65 99
by (4.7k points)
Without additional details it is impossible to help you. Maybe the best option is that you send me the code and I'll try to debug your code for you.