Ad
  • Default User Avatar

    Great to hear that you solved it! I think the basics of this site should be explained in the general docs. It's not pretty convenient to have users explaining them over and over when creating katas. You probably would get at least some insight from http://codewars.com/docs

    It is actually mentioned in the description that the return value should be a sorted array. Usually sorted (string) arrays refer to arrays sorted by Unicode code points or alphabetically (almost the same thing). In addition there is an example in the description.

    I'll mark this issue as resolved for now.

  • Default User Avatar

    Only thing which is required to complete this kata is to have a function called search which takes in two parameters. An object and a string (search(haystack, needle)). Your search function should determine all the properties of the given object (haystack) which contain the needle. Finally your function should return a sorted array which contains all the properties where needle occurred. As described in the description of this kata.

    When you click on "Run tests" button, it will run all the tests in "Your Test Cases" area. Initially you are provided with only one test case. The provided test looks like this: Test.assertSimilar(search(obj,"Codewars"), ["obj2.obj3.something", "obj2.str", "site", "surprise"]). Basically the tests use all of the functions and variables you have defined in your solution. In addition when submitting your solution there will be more tests which you cannot view. Those tests are for checking that your solution works properly in all conditions.

    You can also write your own tests in the "Your Test Cases" area. Therefore you could call your function with whatever parameters you want to. Though you probably want to have your logging inside your solution, not in the test cases.

  • Default User Avatar

    Well, yeah, you are right. Great to hear that you solved it. I'll mark this issue as resolved.

  • Default User Avatar

    Returned array should be sorted alphabetically. Usually sorted (string) arrays refer to alphabetically ordered arrays if there is no mention of how it should be sorted. Leave me a reply if this does not help you forward.

  • Default User Avatar

    No problem! Just remember to remove those logging rows when you are submitting the final solution :) Did you get a grasp of what might be causing the error?

  • Default User Avatar

    You can see all the log messages when you run tests. I couldn't reproduce the unknown error with an empty array. I tested with function search(haystack, needle) { return []; }

    Try logging with console.log('logging goes here');

  • Default User Avatar

    Hi, I'm not quite sure if this is an issue with this specific kata or the site. Did you try to modify and resubmit your code after you pasted it? Are you sure there's no errors in your code? You can always use logging in all of the katas, so maybe it could help you forward.

  • Default User Avatar

    You probably have invalid values in your return value? You can also use logging in all of the katas... Hope this helps you forward.

  • Default User Avatar

    Thank you for your message. Good point about pop/shift. I thought it was quite obvious that you shouldn't take cards from the bottom of the deck (shift), but yeah, I added that to the initial solution as a comment.

    • It's also not clear whether true means the player won or the dealer won.
      • I'd say this is quite clear? It is in the initial solution. "//return a boolean that indicates whether player won. (in case of a tie, return string "tie")"

    About the order of play... well, yeah sure, there is now "Basics of Blackjack" section. I did not explain the whole game in detail, because it is one of the most well-known games in the world (in some form). I also have included a link to the basics of the game.

    In addition I added a note about A, J, Q, K.

  • Default User Avatar

    How come this kata is ranked to 4 kyu? I think you could solve this with some basic knowledge of your language (5-6kyu)

  • Default User Avatar

    Actually that is a basic rule of Blackjack. Not a house rule. Therefore I think it's not important to add a note about it.

  • Default User Avatar

    Arrays are objects too. Though I think the problem is with that typo. Lenght should be length.

  • Default User Avatar
  • Default User Avatar

    Have you checked that your return value is a number? It seems like Test.assertEquals is used which means that === is used when values are being compared.

  • Default User Avatar

    I changed the solution/description a little bit. Now the return value should be a sorted array.

  • Loading more items...