I'm working on PSET6 (Similarities More). It passes check50
and runs perfectly on the command line.
I was also able to create matrix.html
so it displays the matrix correctly (see below). But for some reason, the step-by-step log.html
does not work properly (image below).
Anyone else had a similar issue or any ideas on what may be causing it?
1 Answer
I had a similar issue. I had my numbers right, but the wrong operations associated.
If your value is created by a move to the right, the operation is Operation.INSERTED
. If the move goes downwards, Operation.DELETED
is the value to use. For diagonal, it's Operation.SUBSTITUTED
. Maybe you put something else there (like None
for a field other than upper left corner, where it belongs).
The algorithm that presents the list goes backwards, exactly by following this route. It starts at the lower right corner, and goes in the direction indicated by this field's operation, until it hits None
, which should be in the upper left corner.
-
You pointed me to the right direction (pun intended) :) My issue was that I was assigning Operation.NONE to the matrix when the characters where equal. So when the algorithm found the NONE it would stop generating the list. Fixed by including Operation.NOTHING = 0 at Operation(enum). Working perfectly now! Thanks again!– PXSOCSCommented Jul 23, 2018 at 18:00
-
When characters are equal, you should still use
Operation.SUBSTITUTED
, but assume an operation cost of zero.– BlauelfCommented Jul 23, 2018 at 20:41