4 kyu

RoboScript #3 - Implement the RS2 Specification

Description
Loading description...
Esoteric Languages
Interpreters
Regular Expressions
Algorithms
  • Please sign in or sign up to leave a comment.
  • zLuki Avatar

    This series is amazing!

  • Avanta Avatar

    Perhaps you could make it clearer in the description that having a 0 postfix would also be tested or add an example test case, as I assumed that non-negative meant greater than 0.

  • KataSideKick Avatar

    C# Translation added.Please review and approve~

  • akvptp Avatar

    Kotlin translation, would someone mind reviewing this please.

  • alesdrobysh Avatar

    my solution failed on a random test but then I submitted it successfully without any changes

    is there a possibility for me to know the test that caused failure?

  • ZED.CWT Avatar
  • hufftheweevil Avatar

    Very fun series. Any intentions of extending it further? Maybe add new commands to do something else?

  • JohanWiltink Avatar

    One more suggestion, and I don't know if this is a good one. The output of the random test is, of course, useless. It's just too big to debug. Also, it prevents more random testing because it would overflow the console window.

    Is it an idea to use Test.expect for the random tests? That way you don't get allllll the output, and can do more testing. Downside, of course, is .. you don't get the output. :P

    I don't know what the best option is. Random testing is more useful if (within reason) there's more of it - look at my zero postfix problem, my solution should never have passed, but try a few times and you might get a random test that doesn't trigger your bug if there's too little random testing and there is no fixed test for it.

    Maybe console.log the expanded code (but that can still be ~20k characters! maybe expanded, without parentheses, but (re)compressed with postfixes? even that might not help enough ..), but no actual test output?

  • JohanWiltink Avatar

    I think there should be a fixed test for a zero postfix.

    My solution treats zeroes as ones (because it treats empties as ones - I simply hadn't considered zeroes), so I was (in hindsight) only passing the random test when it did not include a zero postfix. I was wondering what and where the problem was .. but I hadn't looked at the comments yet. And I had not read the instructions that carefully. The description might explicitly state non-negative includes zero, but I think the better option is just an explicit error message with the fixed test.

    It's a valid design decision, but it's easy to miss and randomly it isn't always tested.

  • kazk Avatar

    And of course, brackets are useless if you cannot use them to repeat a sequence of movements!

    Is postfixing with 0 valid? 0 is non-negative integer, but it doesn't help simplifying and useless :(

    // randomly generated RS2 program: LF7FFR((F1LF7LF5R3)0R3FFF3F7RLF0F8)1R1L6F2L1R4
    //                  equivalent to: LF7FFRR3FFF3F7RLF8R1L6F2L1R4