Beta

Clean your shoes rack

Description
Loading description...
Fundamentals
  • Please sign in or sign up to leave a comment.
  • ejini战神 Avatar

    Node 18. (mocha + chai) should be enabled

  • docgunthrop Avatar

    For the 2nd example test case:

    messyRack = [
      [[null, 'nike'], ['sandal1','nike2']],
      [[null, null], ['puma1', null], ['sneackers1', null]],
    ]
    

    The feedback I'm getting is Rack is missing some valid shoes. Based on the Description, the rack should be empty because there are no complete pairs. What am I missing?

    • smolen Avatar

      Indeed empty rack should be a valid solution.

      If you returned valid empty rack as a solution its bug in the testing "framework".

      I will investigate it asap.

      Do you manipulate array values directly?maybe its because you change original array and it yields such result. Its first idea that comes to my mind.

    • docgunthrop Avatar

      My solution doesn't mutate the input.

  • cliffstamp Avatar

    Description :

    • there is so much of this you just have to guess because the description isn't complete and there is no example output

    If both shoes are valid shoes but are not matched which way are they reordered, which pair goes in which shelf (which one moves and which one stays)?

    If only one shoe is valid, what determines the shelf that contains the pair and which shelf gets empty?

    Are you supposed to return an array of nulls for no shoes, or an empty array?

    The only way to solve this is to just keep guessing, that seems not a coding challenge but a patience one, unless this is supposed to be some kind of puzzle where you are supposed to figure out the cleaning pattern of some oddly habited housekeeper.

    • smolen Avatar

      Thanks for the feedback.

      The order of the pairs of shoes does not really matter.Only what matter is that the left shoe has to be on the left side in the shelf spot and the right shoe on the right side.

      If you remove some shoe from the shelf, the null value has to be set as replacement.

      Basically you have to remove damaged and unpaired shoes from the shelf.The order of the pairs does not matter because each housekeeper has its own favorite system.

      I hope it helps, i am going to try to improve description.

      Cheers!

      Issue marked resolved by smolen 6 years ago
  • cliffstamp Avatar

    JS :

    • the test suite won't actually run with the initial code
    • smolen Avatar

      What do you mean ?

      It does run with initial code but it does not passes the tests.I have chosen to throw an error if the solution is not correct. Maybe the error message is not very specific but i guess it should guide you for the correct solution.

      Cheers!

      Issue marked resolved by smolen 6 years ago
  • ZED.CWT Avatar

    Error message is not informative

    Rack is missing some valid shoes

    You need to tell us what are missing to help debug

    • smolen Avatar

      I was thinking to provide more specific errors, but then the kata would be easier to solve i guess.Debugging on your own is also the skill to improve.Am i wrong|lazy?

    • Blind4Basics Avatar

      Debugging on your own is also the skill to improve

      As long as the user knows what he's looking for, yes. But it rather seems that you do not provide all the needed information, for now.

    • smolen Avatar

      @Blind4Basics

      I agree, i have tried to include everything in the description.If the description is not so clear i will going to work on it.Only one warrior attempt to solve this kata and he managed to solved this so its hard to me to guess if the description needs to improve.

      But if noone else will try to solve this it may be due to lack of test examples and bad description.I will try to improve it soon.

      Cheers!

  • ZED.CWT Avatar

    Missing sample tests.

    Sample tests is where we usually put fixed tests to help doing TDD

    • smolen Avatar

      Thanks for the feedback.

      Is there any way for providing preloaded code in test examples? i would like to add custom test function that tests solution.

      I would work on error messages to be more informative.

      Anyway if the description is somewhat clear the test examples can be made by the solver.Is it necessary to provide such tests for this kata?

    • ZED.CWT Avatar

      If you need your own functions to test the results, you could just put them in the sample tests if they are not spoilers Or you can just put to the Preload section which cannot be directly accessed by users And for cases with few posibilities, you can just doing fixed tests in sample tests section without custom test functions, like

      const R = require('ramda')
      let messyRack = [
        [ ['nike2', 'nike1'] ]
      ]
      Test.assertDeepEquals(userSolution(messyRack),[['nike1','nike2']])
      
      messyRack = [
        [['nike1', 'puma2']],
        [['puma1', 'nike2']]
      ]
      let result = userSolution(messyRack)
      Test.expect(R.contains(userSolution(messyRack),
      [
        [
          [['nike1','nike2']],
          [['puma1','puma2']]
        ],
        [
          [['puma1','puma2']],
          [['nike1','nike2']]
        ]
      ]),`Expected ${JSON.stringify(
      [
        [['nike1','nike2']],
        [['puma1','puma2']]
      ])} or ${JSON.stringify(
      [
        [['puma1','puma2']],
        [['nike1','nike2']]
      ])} instead got ${JSON.stringify(result)}`)
      
      messyRack = [
        [['nike1', 'puma2']],
        [['puma1', null]]
      ]
      result = userSolution(messyRack)
      Test.expect(R.contains(userSolution(messyRack),
      [
        [
          [[null,null]],
          [['puma1','puma2']]
        ],
        [
          [['puma1','puma2']],
          [[null,null]]
        ]
      ]),`Expected ${JSON.stringify(
      [
        [[null,null]],
        [['puma1','puma2']]
      ])} or ${JSON.stringify(
      [
        [['puma1','puma2']],
        [[null,null]]
      ])} instead got ${JSON.stringify(result)}`)
      
    • smolen Avatar

      Thanks, i have added a preloaded function for testing the solution.You can test you output of your solution this way.

      Issue marked resolved by smolen 6 years ago