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

andrea.sterbini (167800 points)
488 897 1728
asked Dec 16, 2020 in News by andrea.sterbini (167,800 points)
edited Dec 28, 2020 by andrea.sterbini

NOTICE:

  • Corrections to the exercise text will be posted here
    • As noted in https://q2a.di.uniroma1.it/21149 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 https://q2a.di.uniroma1.it/21019 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 test_01.py by setting DEBUG=True

Instructions

To complete the homework:

  • Install all the required libraries (INCLUDING stopit)
  • Download the HW6rec.zip file and unzip it in a directory
    • The archive contains:
      • a problem to be solved, described at the beginning of file program01.eng.py;
        • your job is to complete the ex1 function inside program01.eng.py 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 program01.eng.py as program01.py 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).
  • DO NOT LEAVE YOUR TEST FUNCTIONS INSIDE THE PROGRAM, UNLESS THEY ARE AFTER THE LINE
    • 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 test_01.py -v -rA
    • or (test printing also a list of the slowest runs)
      • pytest test_01.py -v -rA --durations 0
    • or (test printing a list of the 20 slowest functions executed)
      • pytest test_01.py -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

Submission

You are required to submit ONLY the program01.py file
To do so, go to page https://q2a.di.uniroma1.it/homeworks/delivery?homework=11 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

L
Lexyo (780 points)
1 2 5
answered Dec 22, 2020 by Lexyo (780 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?
m
mjijena (280 points)
0 3 7
commented Dec 22, 2020 by mjijena (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 (4120 points)
31 49 79
commented Dec 23, 2020 by angelo.spognardi (4,120 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.
F
Fran.Cie. (210 points)
0 0 1
answered Jan 21, 2021 by Fran.Cie. (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 (4120 points)
31 49 79
commented Jan 22, 2021 by angelo.spognardi (4,120 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.