Ad
  • Custom User Avatar
  • Custom User Avatar

    Might be showing off. Might be trying to be educational.

  • Custom User Avatar

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

    Please organize the structure of test fixture as following (although it has been mentioned in the attached link, I'm repeated here again)

    describe "<This message should describe the categories of test groups inside this block>" do
      it "<A short message describing this test group>" do
        expect(...).to eq(...) #Assertions
        #Or Test.assert_equals(user_response, reference_response)
      end
    end
    
  • Custom User Avatar

    print is your friend. ;)

  • Custom User Avatar

    This " should pass random tests, where the input returns suggestions from dictionary (53 of 100 Assertions) " is problem for me. I don't understand what need to do. Can someone help me?

  • Custom User Avatar

    Approved. Thanks!

  • Custom User Avatar

    Ruby translation kumited (including some minor update to the description). Please check and approve

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    @FArekkusu your method may still have at least one match from the dictionary. If I replace a random digit with another digit, I may still get a match from another word in the dictionary.

    Example: I have ['ape','ate'] in the dictionary, and I choose '273' (from ape). I replace the center '7' with '8' according to your algorithm. Now, 'ape' wouldn't match with '283', but 'ate' (code '283') would match. So a single replacement may generate a match from another word in the dictionary, where the original point was to avoid any matches by replacing a single digit.

  • Custom User Avatar

    @B4B depends on the implementation. I'd do it like this:

    sequence = list(sequence)
    
    i = randint(0, len(word)-1)
    sequence[i] = choice(list(set("123456789") - {sequence[i]}))
    
    sequence = "".join(sequence)
    

    This will always result in wrong new sequence.

  • Custom User Avatar

    @FArekkusu that wouldn't work at each time to get invalid inputs. But that's the way I'd proceed yes (checking the ratio of valid/invalid inputs afterward)

  • Custom User Avatar

    You know, you could simply replace a digit in the correct sequence and you'd get an incorrect sequence (but that'd be too easy, right?) :D

  • Custom User Avatar

    you did it "the hard way", but that's ok! ;)

  • Custom User Avatar

    Added random test cases, where the given seq will not have a match in the dictionary.

  • Custom User Avatar

    Yes, I get it now. You mean to add random test cases where no match for the given seq will be found in the given dictionary. I will add another set of cases where the given seq will not be found in the dictionary, and where the return value must be a string made up of first letters of letter groups for the given input. Give me a couple of minutes.

  • Loading more items...