Clarifications About HW8

Luigi Pizza (6120 points)
11 20 65
asked Dec 11, 2021 in HW8 by Luigi Pizza (6,120 points)
retagged Dec 12, 2021 by iacopomasi
This was sent by a moderator on "Fondamenti di Programmazione". I thought that it could be useful here also.

-------------------------------------------------------------------------------------------------------------

1. Clarifications HW8-req
.. 1. List of empty colors, which does not "fill" the pattern or "inconsistent" cases.
.. 2. It is assumed that there are no repetitions in the color list.
.. 3. It is not explicitly required to calculate the total number of combinations.
.. 4. In the text the dimension D corresponds to one side of the square image.
.. 5. Double images but I pass the tests.
.. 6. Recursion, dummy function, setting, recursion not detected.
.. 7. Img_properties is obviously a string that contains some text NOT a filename.

1 Clarifications HW8-req
=====================

  Hope this post can clarify some details about * HW8 * given the
  number of questions that have been asked. Let's assume that when
  we prepare the HW is not that in the regular and secret tests we want you
  "fooling" with special cases. Sometimes we just fail
  to immediately specify all possible cases and render
  the exercise cyrstal clear.

  Let's clarify a few points:

1.1 List of empty colors, which does not "fill" the pattern or "inconsistent" cases.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~

  In this case the problem does not arise because if you think about it it is
  like having finished the possible moves in a game tree and therefore the
  your initial state directly coincides with the end. In other
  words, starting from that condition you cannot generate anything
  so the data structure that is requested on return must be for
  empty force. Answer: List empty. If you write the code well, vi
  it should come naturally to generate an empty list, with no cases
  details to manage.

1.2 It is assumed that there are no repetitions in the color list.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~

  This observation is pertinent. It is assumed that there are none
  repetitions of colors i.e. that the colors within the list are
  always unique.

1.3 It is not explicitly required to calculate the total number of combinations.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  Although it's a good thing to think about the problem. Once
  set the recursion correctly it should come for free.

1.4 In the text the dimension D corresponds to one side of the square image.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~

  The text specifies size but means the size of a
  single side of the square image.

1.5 Double images but I pass the tests.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  Excellent observation. Quick answer: if you have duplicates it is likely that
  something is wrong, so you need to fix yours
  code. Long: You can insert assert that this case is relevant.
  I forgot to put the check first on the size of the
  list. Obviously the result is incorrect and passed in a fortuitous manner.
  Try to fix your program first to not
   generate duplicates. Also because it is likely that you will not pass
  timeouts if you generate more images than you should. In the meantime we decide
  with other teachers whether to update the tests.

1.6 Recursion, dummy function, setting, recursion not detected.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~

  Avoid the nasty thing of inserting a dummy function that goes in
  recursion. The problem is structured in such a way that it solves itself well in
  recursive way. I explained in class that one way to attack it is
  as a game tree in which there is an image to build. Let's go
  from the empty state and one can make a move by adding a pixel or a
  something that takes you to another state closer to the solution.
  In the case of patterns, you need to think carefully about the next steps. They matter
  also recursive functions which are defined externally to ex () but
  they are then invoked inside ex () of course. If you define an inner
  recursive function inside ex () I know that you are NOT passing the test of
  recursion. Great warning also in view of the exam.

1.7 Img_properties is obviously a string that contains some text NOT a file.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
350 views

4 Answers

Nilats (3750 points)
7 14 29
answered Dec 11, 2021 by Nilats (3,750 points)

Luigi STOP being so Wholesomecool

iacopomasi (2780 points)
13 19 41
commented Dec 11, 2021 by iacopomasi (2,780 points)
Grande Luigi! I was about to write it today but you beat me.
Quellocinese (2700 points)
2 4 22
answered Dec 14, 2021 by Quellocinese (2,700 points)
luigi, do you accept paypal?
leonardo_13 (1540 points)
6 14 22
answered Dec 15, 2021 by leonardo_13 (1,540 points)
Always the best
z
zoe_matrullo (2090 points)
4 8 12
answered Dec 15, 2021 by zoe_matrullo (2,090 points)
Thanks Luigi! that's very helpful