Ad
  • Custom User Avatar

    Hi,

    You are correct, that error was caused by my modifications.

    After some more bug solving on my algorithm we have 2 algorithms that are different and have the same outcome.

    Just in one case that they are different,
    my says false yours says true

    members [ '56', '78' ]
    rules [ [ '56', '78' ], [ '78', '56' ] ]

    which brings me to the question you have brought.

    You think it is better to expect that the input is clean? If we allow that it is kind of an undefined behaviour where for my algorithm result is A and yours is B. And both of them might be correct.

    this is the link of the random tests => https://pastebin.com/WhBeS2a0

    Hope you get it this time.

  • Custom User Avatar

    (disregard the previous reply if it appears on your end, it has disappeared for me)

    The code in my original kumite fork returns true for the test you mention. It must be something to do with the changes made to resolve the repeating names thing.

    Regarding turning this into a kata, my thought is that inputs should be guaranteed valid (eg no item in the rules refers to a nonexistent family, no repeating members in the list, no member wants to sit next to themself, etc)

  • Custom User Avatar

    Do you have a link to your updated set of tests? That would be helpful.

  • Custom User Avatar

    Hi there, I just did the random input testing to see how they differ.

    Fixed my algorithm in a number of issues dealing with input validation.

    Fixed one issue on your code dealing with repeating names in the family members list.

    Still I have a matching error of .28 when comparing both algorithms.

    for example

    My algorithm says they can sit with this input
    yours says false.
    [ '64', '42', '93', '23', '75', '13', '57', '88', '97' ]
    [ [ '23', '93' ], [ '64', '23' ], [ '57', '88' ] ]

    You can test this on this link.

    If you are going to follow up on this bug please tell me, if not, I will try to deal with it myself, so that we both have 2 good algorithms which assures that both are ok.

    heres the link => https://repl.it/repls/CrazyOldfashionedBlock

  • Custom User Avatar

    Thanks for helping out, I Kind of drafted the first version to see the response. You covered some error cases that I think I don't. Will fix that. And after that I will run both with random data to see if there is a difference from mine to yours, if not we have a solid solution.