Ad
  • Default User Avatar

    Well this made me solve it in 2.5 seconds :p

  • Custom User Avatar

    :whistling:

    Puzzle pieces being unique, you'll never encounter two different pieces that could be assembled with the same third one. So to say: borders are unique.

    :whistling:

    ;)

  • Default User Avatar

    The answer to this question is crucial to solving this kata. It's not apparent from the description, but after reading this comment, I realise I have waisted some time with a way too complex back-tracking strategy.

  • Custom User Avatar

    I've just done it (before seeing your message), using standard markdown link format.

  • Default User Avatar

    its called a freebie and its spelled fun.enjoy:)

  • Default User Avatar

    And ~7 kyu in Ruby.

  • Default User Avatar

    @Hana1989, Thank you for the suggestion, but I think I will keep it the way it is for now.

  • Custom User Avatar

    In addition, I would add some syntax validate (e.g. the function will return None for invalid tags)

    plz, don't wake up FArekkusu... ;o

  • Custom User Avatar

    You're Welcome!

  • Custom User Avatar

    Thank you for taking your time! I will clarify this last rule in a technical note.

    Edit: this rule regarding unary operators is there just because it made sense to me at the moment. As I understand it (and I may be wrong here), there is no consensus on how to manage these precedences when you generalize this much and people tend to use parentheses in order not to be ambiguous. Also, this kata is hard enough as is (wait for the further generalized version that I'm preparing).

  • Custom User Avatar

    Okay, I get the problem here. You are grouping by the operator with the highest precedence using different rules to the ones I define in the description.

    Prefixes and postfixes can only be grouped when they are at the very beginning or the very end of an expression (see my examples with [a], [b], [c] and [d]).

    In this case, the correct grouping would be: 3¨((9,,,)¨(!8)).

  • Custom User Avatar

    If you see my answer to ZED's question, you will see the following:

    Because all operators are assumed to be left-grouping for simplicity [...]. This is only true when x//y//z = (x//y)//z (integer division is usually like that), but in this case the following holds: x//y//z = x//(y//z).

    In your grouping, you are asuming they are right-associative (please, use my definition for this concept).

    The correct grouping would be 323 [[ (5 ]]] [[ 597), and I'm guessing that's the problem here.

  • Custom User Avatar

    I think that's the case @iaeliyen. The : operator is the one that has the highest precedence (23), and that means that it will be "chosen" first using the definition that I gave in my kata.

    Your approach is exactly the same as mine, but I solve recursively in the opposite order, so dont't worry about that.

  • Custom User Avatar

    by reading this:

    2-3^2;
    ^ has the higher priotity, so you calculate 3^2 and then continue.... You don't add () around 2-3 ...

    It seems that you're facing same problem due to non-conventional use of defintion, please see the question I've asked in the same discourse.

  • Custom User Avatar

    Hello! I've run your example to see what the exact order of operations would be:

    1. First, you choose the : operator => (10´´´*´(8)##115):
    2. Then you have two possible operations: *, ##. We choose the second because it has a higher precedence => ((10´´´*´(8))##115):
    3. The only thing we can do here is a multiplication, so we do that => (((10´´´)*(´(8)))##115):

    If I'm not mistaken, the way you order the infix operators would be the problem. I suggest you use a translation of the approach I used here.

    I hope this is clear enough.

    Cheers :)

  • Loading more items...