Ad
  • Custom User Avatar

    Does not appear to be a kata issue.

  • Default User Avatar

    Thank you so much for this example. I was missing this part too. Cause i counted only the first choices.

  • Default User Avatar
    [ [ 'a', 'c', 'b', 'd', 'e' ],
      [ 'd', 'c', 'a', 'b', 'e' ],
      [ 'e', 'b', 'd', 'a', 'c' ],
      [ 'e', 'a', 'b', 'c', 'd' ],
      [ 'b', 'c', 'e', 'a', 'd' ] ]
    
    • a has 1 first vote
    • b has 1
    • c has ZERO
    • d has 1
    • e has 2

    Clearly, c with 0 votes has the least first votes so c is eliminated.

    a, b and d have less votes than e, sure, but c has even less.

    Next step:

    [ [ 'a', 'b', 'd', 'e' ],
      [ 'd', 'a', 'b', 'e' ],
      [ 'e', 'b', 'd', 'a' ],
      [ 'e', 'a', 'b', 'd' ],
      [ 'b', 'e', 'a', 'd' ] ]
    

    a, b and d have 1 vote but e has 2:

    a, b and d are eliminated.

    e is the only one left : e wins the election

  • Custom User Avatar

    Thanks, I had the same question. The description of the kata really needs to be improved.

  • Custom User Avatar

    Unless I'm mistaken, the following voter array:

    [ [ 'a', 'c', 'b', 'd', 'e' ],
      [ 'd', 'c', 'a', 'b', 'e' ],
      [ 'e', 'b', 'd', 'a', 'c' ],
      [ 'e', 'a', 'b', 'c', 'd' ],
      [ 'b', 'c', 'e', 'a', 'd' ] ]
    [ [ 'c', 'e' ],
      [ 'c', 'e' ],
      [ 'e', 'c' ],
      [ 'e', 'c' ],
      [ 'c', 'e' ] ]
    [ [ 'c' ], [ 'c' ], [ 'c' ], [ 'c' ], [ 'c' ] ]
    

    Should reduce correctly to 'c', but the test insists that 'e' is correct by the kata.

    As stated by some users, the kata is missing the statement "if a voter is not in any first-preference vote, then remove it from all voting ballots."