Ad
  • Default User Avatar
  • Default User Avatar

    Oh. Okay. I was testing it in irb but I guess I did a poor job then :')

    Looking at ~/.irb_history, I did use two dots... even though I was specifically wondering about the difference between the two. Sigh.

    Aight. Send it.

    Thank you!

  • Custom User Avatar

    one tiny bug: rand(0...10) that's inclusive, so that's 11 outcomes where in python it's 10. I don't actually care and will approve that, would be nice if it's the same though. same with 0...5 of course

    It's not inclusive.

    I added the other cases.

  • Custom User Avatar

    There are also some extra edge case tests in JS which are probably worth adding:

    it("more fixed tests ( d < 800 )", function() {
        assert.strictEqual( alphabet([4,51,2,51,2,1,8,204]), 51 );
        assert.strictEqual( alphabet([7,9,747,7,1,63,83,83]), 83 );
        assert.strictEqual( alphabet([520,3,39,3,13,40,40,1]), 40 );
        assert.strictEqual( alphabet([1,350,15,8050,345,350,15,23]), 350 );
        assert.strictEqual( alphabet([737,639,9,71,4422,6,54,52327]), 737 );
      });
    
  • Default User Avatar

    Oh sweet. Still reading.

    set operations on array? weird language. had to go try it to see if it actually did the right thing x)

    one tiny bug: rand(0...10) that's inclusive, so that's 11 outcomes where in python it's 10. I don't actually care and will approve that, would be nice if it's the same though.
    same with 0...5 of course

  • Custom User Avatar

    You're right, and thanks for the feedback. I made them distinct and followed the logic of Python snippet you provided. Check it out!

  • Default User Avatar

    Hi! I will not dig into discourse to figure out why you're making this, but, the current ruby implementation is obviously wrong so it's presumably about that if I was to look.

    So, I'm glad to see this already here.

    However. Still wrong. This implementation doesn't guarantee that A B C D are distinct since you pick four random values for them.

    One way to go about it is to put all candidates in an array and swap the chosen element with the end and then pop off the end. Another way to do it is to re-try the roll if it rolls an already chosen value - this is typically better when the pool is large and the desired amount of values is small, such as here.

    Could you make that update? I'm quite keen to press the approve button after that even if I don't know ruby and will do a poor job of looking it over -- since the current one is entirely broken.

    The python version has some additional code related to edge cases that uhm I have no clue if that's good or bad really, but seeing as python is the original language and has the most solve, I would copy exactly what it says there.

    this is how it reads there:

            a, b, c, d = sorted(sample(range(1, 100), 4))
            
            # Tweak the inputs to generate interesting edge cases more often
            if not randrange(10):
                a = 1
            if not randrange(5):
                d = randrange(200,800)
    
            numbers = [a, b, c, d, a*b, b*c, c*d, d*a]
            shuffle(numbers)
    
  • Default User Avatar

    The description appears incomplete. It would be nice to describe the requirements for the where method there. For example: “the where method of the AnimalsRegistry class should return a list of all animals with characteristics corresponding to the arguments” and an example of the arguments - something like this, this would save time on understanding the task.

  • Custom User Avatar

    Kata has been updated.

    Thanks for your feedback.

  • Custom User Avatar

    not sure include the registry in the Animal class is a good idea

  • Custom User Avatar

    Thanks for the feebacks, description has been updated.

  • Custom User Avatar

    except that, with the current description, the kata actually looks like it's a puzzle until one enters the trainer.

    => the description is missing the actual task: "you have to implement the AnimalsRegistry class" (as in, explicitely)

  • Custom User Avatar

    I changed the kata name to be more accurate.

  • Custom User Avatar

    Tags have been updated, thanks for the feedback.

  • Custom User Avatar

    What does this kata have to do with OOP or puzzle? The kata requirement has mostly been sufficiently specified through description and initial code, and there is nothing in the kata that utilizes OOP-specific features.

    Irrelevant tags should be removed to avoid cluttering the kata search.

  • Loading more items...