6 kyu

Techno Barman

Description
Loading description...
Algorithms
Fundamentals
View
AllIssues2QuestionsSuggestions1Show Resolved
  • Please sign in or sign up to leave a comment.
  • Ciprian Amza Avatar

    Approved as 6 kyu.

  • saudiGuy Avatar

    someone should approve this kata..

  • fragged_again Avatar

    If there is coffee in the glass, the bottom layer is always filled with \ character.

    I initially understood this to mean that if prg>0, then the bottom layer is always filled. But in fact if prg is so low that it does not fill even the first layer, then it is empty too.

    Maybe it could be clearer with "The slashes alternate between layers, starting with \ in the lowest one and / in the next layer."

  • Nekose Avatar

    "The area on which the percentage is calculated is w(h-1)"

    As I understand it, the area should be calulated as "(w-2) * (h-1)". This accounts for the bottom of the glass and the walls of the glass.

  • Blind4Basics Avatar

    Hi,

    • You didn't specify the order of the chars for the coffee. For instance, for an odd number of lines, is it /\/ or \/\? (from top to bottom, I mean) Same kind of problem happens for even numbers, actually...
    • => considering the bove, you need more sample tests too.
    • the width for the first sample test is wrong
    • the output should be a unique string, not a list of lists
    • you need more fixed tests (a lot of situations aren"t covered for now. possibly add random tests with inputs of reasonnable sizes...
    • I don't see the point for "big" inputs, here... => ?
    • eptaceps Avatar

      hi, thanks for pointing out issues. is it better now?

    • Blind4Basics Avatar

      Good effort, but unfortunately you introduced new problems at the same time... ;)

      • plz select python 3.6 as the default language version, in the edit panel (I forgot previously)
      • new part of the description: You don't have to include "\n" in the output string -> x/ Na, that's asbolutely bad. The user should be able to print his output and that it looks like the expected figure. Change that, plz.
      • about the assertion/sample tests: the addtiionnal error message is a good idea... when displayed in the console. Other wise, it's totally unreadable in the sample tests part. I'd suggest the following:
        • remove all additionnal message
        • build your own test funcion in which you pass the actual and expected results.
        • inside the function, you print the strings to the console first (with some space/legends around)
        • then you do the assertion
        • ofc, you put a limit size on the string, for displaying them to the console (otherwise you'll hit the max buffer limit error) => print the strings only if, say, their length is shorter than 200-250, maybe? (maybe more...)

      other than that, it looks fine, I'd say. Ah, one last thing: Notice that the glass has been filled by defect for non native speaker, this "defect" is rather obscur. I find that annoying considering this is actually hidding one of the requirements...

    • eptaceps Avatar

      D: ok i try to fix;

      • instead the user should include "\n" ?
      • something like this?
        if my_test(user_function(), expected):
             test.pass_()
        
      • do you mean that i should explain more what "defect" means?
    • Blind4Basics Avatar
      • string: yes, join each line with a \n
      • tst function:
      def doTest(actual,expected):      # using python 3.6
          if len(expected) < ...:
              print(f'''
      Expected:
      {expected}
      
      Actual:
      {actual}''')
          Test.assert_equals(actual,expected)
      
      • defect: that or use another wording, maybe. As you prefer.
    • eptaceps Avatar

      ok, thanks should be ok now

    • Blind4Basics Avatar

      almost:

      w = 8
      h = 10
      prg = 33%
      
      Expected :
      
      *      *
      *      *
      *      *
      *      *
      *      *
      *      *
      *      *
      *//////*
      *\\\\\\*
      ********
      
      Actual :
      
      *      *
      *      *
      *      *
      *      *
      *      *
      *      *
      *      *
      *//////*
      *\\\\\\*
      ********
      '*      *\n*      *\n*      *\n*      *\n*      *\n*      *\n*      *\n*//////*\n*\\\\\\\\\\\\*\n********' should equal '*      *\n*      *\n*      *\n*      *\n*      *\n*      *\n*      *\n*//////*\n*\\\\\\\\\\\\*\n********\n'
      
      • the display is good, globally
      • description:
        • that example must be short so that it's at least a bit usable...
        • the example of out must be actual code string, not formatted string (=> either put 4 spaces at the beginning of the line, or put backticks around it / on second thoughts, having both versions, meaning formatted/unformatted might be a good idea)
      • the expected result is... feels kind of "wrong": you chose to put an "extra" \nat the end of the string... That's described (even if for now there is no visible code string showing that), so it's actually ok. But it really feels like practice from another era, especially when you use something like python... Imo you should remove that one.
      • the assertion process is a bit weird, for now. You should update it to something like this
      
      def doTest(get_glass, a,b,c, expected):
          actual = get_glass(a,b,c)
          ...
          
          
      
      do_test(get_glass, 3, 3, 50, "* *\n"    \
                                   "*\\*\n"   \
                                   "***\n")
      

      This way, the design is more reasonnable and more readable (and it avoids duplicated code/data)

      Note: you could add another note to the description, that the actual and expected results will be printed to the console for the user, unless the size of the output is too large.

    • eptaceps Avatar
      • then i change the last example in description to something smaller ? like 5-6 height
      • how could i deal with those extra "\n" ?
      • test function and additional note on description : ok i will fix
    • eptaceps Avatar

      changed description and test function. added f-strings when printing

    • Blind4Basics Avatar

      do you mind if I edit your kata?

    • eptaceps Avatar

      not a problem

    • Blind4Basics Avatar

      done. See if it suites your mind too.

      Note: I've changed the requirements and the description about the final "new line" (I removed it)

    • eptaceps Avatar

      ok, it's better now :o thanks for help!

    • Blind4Basics Avatar

      you're welcome

      oh, btw, for your next kata: always keep the sample tests at the beginning of the test suite (only the "test cases" part is executed in an attempt)

    • eptaceps Avatar

      ok, thanks :)

    • Blind4Basics Avatar

      ('forgot to resolve it, sorry)

      Issue marked resolved by Blind4Basics 5 years ago