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.

Output doubt

y
yyxxzn (390 points)
0 3 5
in HW2 2nd chance by (390 points)

As an example,
    ex1(0x5B23, 0xC78D, 0x44AE, 0x1612, 0x90FF, 1000,
        [ ((0x44AE, 0x5B23),  800, 0x1612,  4),
          ((0x44AE, 0xC78D),  800, 0x90FF, 10),
          ((0xC78D, 0x5B23),  400, 0x1612,  8),
          ((0x44AE, 0xC78D), 1800, 0x90FF, 12),
          ((0x5B23, 0x44AE),  100, 0x1612,  2)
        ]
    returns
    ( [2098, 568, 0], [66, 268], [ [0, 0, 0], [0, 0, -28] ] )
    because all players start with 1000Ħ in their account and, at the end,
    – the balance of player 1 amounts to 2098Ħ,
    – the balance of player 2 amounts to 568Ħ,
    – the balance of player 3 amounts to 0Ħ,
    – intermediary 1 earned 66Ħ,
    – intermediary 2 earned 268Ħ,
    – player 3 still owes 28Ħ to intermediary 2.

This is the example of the HW2rec and it returns the balance of the players(first list), the earnings of the intermediary(second list). Now in the third list, the second list represents the debt, but the first list ([0, 0, 0]), I don't know what does represent.

318 views
closed

1 Answer

Best answer
b
benjamin (2490 points)
1 7 21
by (2.5k points)
selected by
I think is how much debt each player has with the intermediary... Having two 2 intermediary in the example you have two lists..

 The 000 list means that noone has a debt with int 1
by (2.8k points)
Yes, indeed.

The third element in the tuple is a nested list reporting, for every intermediary, “the remaining debts of the player’s accounts (0 if no debt was accumulated, or a negative integer otherwise)” (quoting the text of the exercise). Therefore, intermediary 1 has no credit with any player, whereas player 3 owes 28Ħ to intermediary 2.

Best regards,
CDC