Ad
  • Custom User Avatar

    resolving

  • Custom User Avatar

    Done, thanks!

  • Custom User Avatar

    Will something like func([20, 20, 20, 20], 20) work?

  • Custom User Avatar

    You mean in examples?

  • Custom User Avatar
  • Custom User Avatar

    Sorry about that. I was planning to reply to this comment when I found out that the original solution is incorrect. Couldn't fix it in time, sorry again you had to check incorrect code. Anyway it's all good now. I've updated description, specs and solution

  • Custom User Avatar

    Thanks! Done

  • Custom User Avatar

    Can confirm that as of now Kata is fully working. However use of old version of Solidity along with rather poor tests make it not very enjoyable as it was hard to understand whether the tests were broken or the code.

    I also feel like both assert and require should work here. And since only assert works it needs to be specified in description

  • Custom User Avatar

    @Blind4Basics I don't think that neither ruby code nor codewars is about writing efficient code, rather it's about writting a readable, easy to understand code.

  • Custom User Avatar

    sum on a string returns a sum of binary values in a string.
    Range of english alphabet in binary is 97..122 so to convert to a range of 1..26, you need to substruct 96 times the number of chars(x.size * 96)

  • Custom User Avatar

    Hey guys, try this set of test, they should properly cover most of the requerements

        hi = { one: 'one', 'two' => 'two' }
        Test.assert_equals(hi._one, 'one')
        Test.assert_equals(hi._two, 'two')
        Test.assert_equals((hi._one = 'one!'), 'one!')
        Test.assert_equals(hi._one, 'one!')
        Test.assert_equals((hi._two = 'two!'), 'two!')
        Test.assert_equals(hi._two, 'two!')
        Test.assert_equals((hi._three = 'three'), 'three')
        Test.assert_equals(hi._three, 'three')
        Test.assert_equals(hi[:three], 'three')
        
        nasty_hash = { enabled: nil, 'enabled' => true }
        Test.assert_equals(nasty_hash._enabled, nil)
        Test.assert_equals(nasty_hash._enabled = false, false)
        Test.assert_equals(nasty_hash[:enabled], false)
    

    One hint for those who is struggling

    [false].any? === false
    
  • Custom User Avatar

    Tests should check that you monkey path only methods that start with '_'
    hash.no_method should return exception error, most of the current solutions would just try to find hash[no_method]

  • Custom User Avatar

    Yeah, I did. Thanks, didn't know that can be an issue

  • Custom User Avatar

    It seems to me that random tests in Ruby are broken.

    In every test expected value is 0 and if you log given string it is clear that 0 is not a correct answer.

  • Custom User Avatar

    return is unnecessary.
    Fixnum has a method negative.
    -num will work just as good as 0-num

  • Loading more items...