6 kyu

Wheel of Fortune

460 of 787Uraza
Description
Loading description...
Games
Arrays
Algorithms
  • Please sign in or sign up to leave a comment.
  • jinks908 Avatar

    The test case:

    [ { name: 'Bob', scores: [ 10, 65 ] }, { name: 'Charlie', scores: [ 5, 105 ] }, { name: 'Bill', scores: [ 90, 5 ] } ]

    is expecting "false" when the answer should clearly be "Bill." Interestingly, it's under the score validation category, but nothing here should return false. The description says:

    "The winner one that is closest to 100 (while still being lower or equal to 100) ... Your solution should return the name of the winner or false if there is no winner (all scored more than 100)."

    So, simply having one candidate go over the 100 mark is not sufficient for falsehood, only in the event that ALL of them break 100. Bill has the highest score here (95) without going over. I don't understand how this should be false.

  • jlb071 Avatar

    You don't "roll" the wheel .... you SPIN it :-)

  • Lucasss Avatar

    This comment has been hidden.

  • Lucasss Avatar

    This comment has been hidden.

  • user6720290 Avatar

    this would have been fun if not for the incessant input validation

  • monadius Avatar

    Ruby: no sample tests.

  • user9644768 Avatar

    Ruby 3.0 should be enabled, see this to learn how to do it

  • MobulaKuhlii Avatar

    Hmm??? Ruby random test ---

    [{"name"=>"Shapiro Keats", "scores"=>[15]}, {"name"=>"Death Gaia", "scores"=>[55]}, {"name"=>"Helmat", "scores"=>[80, 85]}]
    It should work for random inputs too -  Expected: "Death Gaia", instead got: false
    

    So how's that valid? isn't scores sum supposed to be lte 100 and that's what the fixed test invalid input cases -> should check that scores are valid is for?

  • user9644768 Avatar

    Please use new python test framework.

  • gkucmierz Avatar
    [ { name: 'Gandalf', scores: [ 85 ] },
      { name: 'Ned', scores: [] },
      { name: 'Rob', scores: [] } ]
    

    Why tests are ezpecting "Gandalf" here, while other players dont have any score? Shouldnt answer be false in this case?

  • IsAllen Avatar

    When submitting using Python 3.4.3 the following error occurs: "NameError: name 'xrange' is not defined" even though I didn't use xrange() in my code.

    Switching back to 2.7.6 circumvents the issue.

  • dejongnj Avatar

    I passed all the test cases, but when I submit I fail on the first one. Using console.log I get the input of the candidates array as: [ { name: 'Bob', scores: [ 10, 65 ] }, { name: 'Bill', scores: [ 90, 5 ] }, { name: 'Jennifer', scores: [ 55 ] } ] This test should fail because it has invalid input (Jennifer has only one score) according to the kata description criteria: "Please note that inputs may be invalid: in this case, the function should return false". However, it expects "Bill" as the right answer.

  • phil.harmoniq Avatar

    This comment has been hidden.

  • machinedarkly Avatar

    For test 14, I get 'Gandalf' in IDLE but on here it's failing for some reason. The program thinks I am getting 'False' for some reason.

  • Insti Avatar

    In the Ruby tests:

    should check that candidates rooled the wheel once or twice

    Has a typo, it should be 'rolled'

  • tryllid Avatar

    I assumed that having less than 3 candidates meant the game could not be played. I also assumed that the having no scores or less than 2 scores under 100 meant that the entry could be kicked out. Are those assumptions correct?

  • tryllid Avatar

    How do I get console.log to print out? Using the python version. Is it a command at the bottom of the code or at the top?

  • lib-lib Avatar

    I have passed the test case, but when i submit my code, feedback error : expected Bill instead of false. Why ??

  • vtange Avatar

    This comment has been hidden.

  • andreamazza89 Avatar

    Thanks for the nice kata :), just one small suggestion for the Ruby description:

    Replace

    You receive the information about each candidate as an array of objects: each object should have a name and a scores array with the candidate roll values.

    with

    You receive the information about each candidate as an array of objects: each object should be a hash with two key/value pairs with the following keys: "name" and "scores". "name" is the name of the participant, "scores" is an array with the candidate roll values

  • GiacomoSorbi Avatar

    Python and Ruby translation provided, if you want to approve them :)

  • Currell Avatar

    Did you mean to name this Kata "The Price is Right," because this is not how "Wheele of Fortune" is played? Just sayin.'

  • powderham Avatar

    Hello all,

    I am getting an TypeError: Cannot read property 'length' of undefined at winner at one of my test cases. Has anyone encountered this?

    I am setting winner = candidates[i].name which is accepted by the majority of the test cases except returns an error on one. Given that I am setting winner to a name, which is a string, I can't understand why this Kata is calling .length on it.

    I would appreciate it if someone could tell me where I am going wrong with this.

  • donaldsebleung Avatar

    Needs random test cases

  • Aliona_Kastsevich Avatar

    A little bit more difficult than it seemed at first. It was interesting to solve it. Most time gone to check all exeptions. But good instruction were written, so I think this Kata is ready=)

  • oldccoder Avatar

    This is really a kata about error checking much more than a working algorithm. Perhaps you may want to inform the coders of what errors to check for rather than waiting to get flagged during the submit.