6 kyu

String Pyramid

217 of 719user5036852
Description
Loading description...
Mathematics
Strings
Algorithms
ASCII Art
  • Please sign in or sign up to leave a comment.
  • ahmet_popaj Avatar

    Wonderful and enjoyable kata, congratulations.

  • eurydice5717 Avatar

    This comment has been hidden.

  • nachoMonllor Avatar

    Beauifull kata !

  • RealSup Avatar

    For C# is possible to pass tests with not full solution. Tests does not consider cases with reccuring chars, like "1232" or "KEKE". Thats why my solution can't pass example "aaaaa" from description, but i solved this kata.

  • RealKenshiro Avatar

    Funny and cool Kata!

  • ForceQWE Avatar

    I enjoyed a lot

  • itacirgabral Avatar

    a lot of work fixing boudaries. the characters = "" case is useless

  • cool3r Avatar

    Nice kata, thx author) thought a lot about the fourth method.

  • CaHudson94 Avatar

    So I am passing all the sample tests and everything I do on my own end but it is throwing and index error any time I try and submit?

  • complexbear Avatar

    Really enjoyed this one. After some refactoring I got a pleasing level of code reuse across the 4 public functions. :)

  • mahoney Avatar

    I get this error message (TypeError: object of type 'NoneType' has no len()) altough the code works perfectly fine in spyder. What am I missing here!? Thanks for any help!

  • ionutaxenie Avatar

    Count should not be -1 for an input of 0 size, it makes more sense for it to be 0. Other than that, it was fun to do. :)

  • Chatmouraï Avatar

    Hello everyone, I have a System.NullReferenceException with the EmptyTest but I don't anderstand why ? I check IsNullOrEmpty and if it's true I return characters, it works on visual studio but not here :/

    C#

  • jonaslimads Avatar

    I don't know why, but when I hit "Run suite" it gives me Passed: 0 Failed: 0 _EmptyTest

    What does it mean? Thanks a lot!

  • docgunthrop Avatar

    Nice kata, SteffenVogel, but this kata should probably be ranked one higher (to 5kyu).

  • dinglemouse Avatar

    Unusual for Java method names to start with uppercase - eg BasicTest2, Visualisation ...

  • dinglemouse Avatar

    The Java implementation seemed a bit weird passing that same characters parameter to all those static methods each time. Wouldn't it be better to construct a Pyramid instance then only pass the characters to the constructor, and also simplify all the method names?

    Like this:

    public class Pyramid {
      public Pyramid(final String characters) {
        // FIXME
      }
      public String watchFromTheSide() { /* FIXME */ return ""; }
      public String watchFromAbove() { /* FIXME */ return ""; }
      public int countVisibleCharacters() { /* FIXME */ return 0; }
      public int countAllCharacters() { /* FIXME */ return 0; }
    }
    
  • dinglemouse Avatar

    This comment has been hidden.

  • eseuteo Avatar

    Well, I need some help here. I have done the kata, and it passes the tests. The problem emerges when I submit it. My code fails the null/empty test everytime and the random test most of times, and in both cases, the message given is: "expected:<-1> but was:<1>". Could someone explain to me what am I doing wrong? Thanks!

    p.s.: nice kata!

    Edit: the message is this: expected:&*lt;-1&*gt; but was:&*lt;1&*gt; (without the asterisk)

  • pi_etre Avatar

    Such an original kata, had a lot of fun solving it.

  • nova_n Avatar

    My pyramid for the side view is coorect, but it does not pass. Must i add the same ammount of spaces as i did before the set of charachters? and if so, why?

  • lanceculnane Avatar

    I struggled with this a lot as a noob (in python) because I got some misleading error messages (Before I learned I should do if (not characters): return characters (or-1)...) For instance, if I made my output -1 when the input was an int, it would say "1 should be -1" even if an entry of 1 really did produce -1. Similarly, sometimes it said "-1 should be '' ", even if I were to make it so that an input of -1 really did give ''. I'm guessing what happened is that your test would test for an empty string '' and then somehow the error message was "1 should be -1" or something. If possible, it would really help future codewar participants if you could use the same language in the error messages as you did in the kata description. (ex "empty string should return an empty string for viewing and -1 for counting funcs"). I'm happy to email you some of the submissions I was getting odd error messages, if you think it is worth the time. My email is in my github acct /lanceculnane

    Other than that, I really enjoyed this kata- thanks! I finally got it after I did if not characters: return characters!

  • sebinievas Avatar

    Can you better explain how to arrive to the last count? I am trying to visualize it and cannot match the numbers as to what you're asking for. Thanks in advanced!

  • rxbx Avatar

    This comment has been hidden.

  • waytoodanny Avatar

    I suppose this kata worth 5 or 4 kyi, very interesting task, thanks SteffenVogel_79.

  • user5036852 Avatar

    Can someone approve this kata?

  • Kaiyou Avatar

    For the standard test cases the kata gives helpful output about how it should look and how it does look. However, the output from BasicTest3 appears in the same hierarchy as the message (for example "Test Passed") from BasicTest2 and the output from BasicTest2 appears outside of the hierarchy (I mean the parts you can fold) altogether. Was it designed this way or is this a mistake?

  • user4912975 Avatar

    In c++, you've used the pow() function for generating solutions, but you haven't used the header file . This results in an error, hence revealing the critical part of the code for the functions solutionCountVisibleCharactersOfThePyramid() and solutionCountAllCharactersOfThePyramid().

  • HerrWert Avatar

    Hi Steffen, You asked for some feedback on your English descriptions. I would suggest the following improvements:

    • for this four methods --> for these four methods
    • that are visible from outside the pyramid --> that are visible from above the pyramid
    • full massive --> completely solid
    • angels --> angles


    I don't know if it would cause major problems to change the function names, but "view" would be better than "watch." The use of the word "watch" implies that the pyramid will be moving or doing something.

    Danke für diese interessante Kata in Javascript! Wie immer ist meine Lösung eine der längsten :-P

  • zebulan Avatar

    Thanks for this kata @SteffenVogel, I enjoyed solving this one. As @Dentzil already mentioned, great tests as well.

    Python translation kumited!

    Also, I tested it using both versions of Python (2 & 3).

  • Dentzil Avatar

    C++-Translation kumited!
    Signed, sealed and delivered.

    You are as always very diliget in writing tests. ;)

  • smile67 Avatar

    Did two submits without error, but no "submit final button" appears... closing, opening the kata, a third try and it works... very strange;-)... What is it 7kyu or perhaps 6 - give me a hint;-)?!