Ad
  • Default User Avatar

    I just finished the kata and yes the largest number is smaller than 4000, as it would not be possible to build it with the given rules

  • Default User Avatar

    What's the largest number to convert? is it in the range(1, 4000)? Because for larger numbers "M" is not sufficient...

  • Default User Avatar

    In my opinion it should be added to the description that the stack starts with an initial element 0. However, that is easy to figure out. IMO it should say in the description that the in-/decrement operations are to be performed on the top element.

  • Default User Avatar

    @mingzhou thank you very much for the explanation, this helped me to understand it :)

  • Default User Avatar

    I have the same issue with python. I am guessing there has to be a way to not run into precision issues.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    I feel like I am not getting something. According to wikipedia a 4-connected pixel is:

    4-connected pixels are neighbors to every pixel that touches one of their edges. These pixels are connected horizontally and vertically. In terms of pixel coordinates, every pixel that has the coordinates (x+-1, y) or (x, y+-1) is connected to the pixel at (x, y).

    So the way I am understanding it, that a pixel at (x, y) is 4-connected where all neighbors [(x+1, y), (x-1, y), (x, y+1), (x, y-1)] are white (in this case). In the example I can only see one of those. I replaced it with an x:

    +----------+
    | *** ** * |
    | *x**** **|
    | ** *   * |
    |    *     |
    +----------+
    
    

    I am pretty sure I am misunderstanding what is meant. Any help is highly appreciated.

  • Default User Avatar

    Oh, ups.. I didn't know it is not possible to submit in that case...

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    There is an error in the Test-cases in the python translation.

    When I attempt to test my solution I get following error:

    Traceback (most recent call last):
    File "main.py", line 51, in
    p = random.choice('123456789') + ''.join([random.choice('0123456789') for char in range(len_of_random)])
    File "/usr/local/lib/python2.7/random.py", line 277, in choice
    return seq[int(self.random() * len(seq))] # raises IndexError if seq is empty
    NameError: global name 'int' is not defined

    Therefore in generating the random tests 'int' was used, which was Disabled by default...... This only occurs in python 2.7

  • Default User Avatar

    Am I the only one who thought this is way too difficult for 7kyu??

  • Default User Avatar

    Could someone explain to me, why this solution works? I was looking for a smart way on how to choose which number to pick, but I could not come up with one. So instead I used memoization. But I can's seem to understand what the rule is here and why it works. Could someone elaborate on it?

    Thanks in advance :)

  • Default User Avatar

    Thanks, for the heads up. I rewrote my code and got it to pass :)

  • Default User Avatar

    I am running in a failed test/an error when executing this code: 'ssstnssstsnsssttntnstnsnntnsttnstnssnnnn'
    It is the third test in 'Testing conditional and unconditional jump functionality':

    Here is how I interpret the code so far:

    (ss stn) (ss stsn) (ss sttn) (tn st) (n sn n) tnsttnstnssnnnn

    ss add stn to stack (1)
    ss add stsn to stack (2)
    ss add sttn to stack (3)
    tn st pop 3 from stack adding to out out = 3
    n sn jump unconcitionally to label n (label='') but the label is not defined yet.. so what do I do??

    The options I thought about:
    Expect the next few characters to be a number -> results in an infinite loop
    call whitespace with the remaining code to use the output as a position for the label '' to jump to -> results in an error
    call FlowControl as I expect the next few caracters to declare the label with the remaining code -> no labels are declared
    call FlowControl as I expect the next few caracters to declare the label with 'ss'+code -> declares label 't' not '' as expected

    I am running out of ideas.. How am I supposed to interpret this?
    Any help is highly appreciated :)

    I just had another thought I am basically compiling on the fly... Do I have to evaluate the code first and do everything (so executing the functions) afterwards? So basically a label could be declared at any point in the code?

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Loading more items...