Please ignore secret bonuses. Secret tests do NOT award bonus. Max hw grade is 30+2 bonus efficiency

Do you need help?

Notice Board

Per partecipare al corso di Fondamenti di programmazione 2023-24 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 2023-24 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 8 required

andrea.sterbini (207920 points)
750 1267 2373
in News by (208k points)
edited by

NOTICE:

  • Corrections to the exercise text will be posted here, keep an eye on this page
    • For more clarifications see also https://q2a.di.uniroma1.it/24089/clarifications-about-hw8
    • Suggestion: you can consider that the "move" of the game tree, is adding a new pixel to an image partially defined.
    • NOTICE: you can assume that the  colors will be always different and that at least 1 will be present.
    • NOTICE: please place your recursive function at the outermost level, else the recursion test will fail.
    • NOTICE: an iterative solution that build some pattern without using recursion is invalid and will void your program. The same for using a dummy recursive function to fool tests.
  • NOTICE: to disable some safety checks and the timeout, change test_01.py by setting DEBUG=True
  • NOTICE: to keep safety checks but use a bigger timeout, change test_01.py by setting a bigger WARP factor

Instructions

To complete the homework:

  • Install all the required libraries (INCLUDING stopit)
  • Download the HW8-req.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;
      • a file named program01.txt where you should describe your algorithm in English (keep it anonymous: no id/names or source code);
      • 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;
    • edit file program01.txt to describe your algorithm.
  • 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).
    • After the final deadline some secret tests will be applied and your program could fail tests not showing the same patterns.
  • 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 4: (version 5 is not supported by these plugins)
      • 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.

First deadline: 23:59 of 18/12/21 (REQUIRED FOR EVERYBODY)

  • The first deadline is strict and EVERYBODY should submit both their files
  • The next day you will be assigned up to 3 anonymous algorithms to assess and suggest improvements
  • Submit your assessments and suggestions by 23:59 of 20/12/21
  • You will receive up to 3 suggestions from your peers
  • You will have time until 23:59 of 22/12/21 to evaluate ALL the suggestions received and then re-submit new, better programs

Submission

You are required to submit BOTH the program01.py and the program01.txt files
To do so, go to page https://q2a.di.uniroma1.it/homeworks/delivery?homework=9 and submit both files
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.

Please log in or register to answer this question.