Beta

Derpcode Interpreter

40 of 55beniolenio
Description
Loading description...
Esoteric Languages
Interpreters
Algorithms
View
AllIssues8Questions1Suggestions1Show Resolved
  • Please sign in or sign up to leave a comment.
  • matthewmoppett Avatar

    Should it be possible to access bits at negative indices, i.e. by flipping or printing them? The instructions seem to imply that negative indices are purely notional, used only for the program termination process. But the random tests (at least for the Rust version of this kata) have input like "derp a-derp. a-derp herp a-derp derp herp", which requires flipping the bit at -1 twice, as well as moving the bit pointer to -2 temporarily.

    I think this should either be clarified in the kata description (e.g. making it clear that the bit "tape" should be accessible in both positive and negative directions), or the random tests should be fixed so that they don't require access to negative indices.

  • Unnamed Avatar

    Write the current bit and the next seven bits to stdout as an ASCII character.

    Some tests have . for values greater than 127.

    • beniolenio Avatar

      What tests?

    • Unnamed Avatar

      The test expecting 'p0æs', æ is non-ASCII. (And the return type is str, so there's no way to convert it without knowing the expected encoding.)

    • beniolenio Avatar

      is 'æ' not ascii 230? I was under the impression that python's chr and ord functions used ascii codes.

    • Unnamed Avatar

      ASCII has 128 characters. Python uses Unicode.

      >>> 'æ'.encode('ascii')
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
      UnicodeEncodeError: 'ascii' codec can't encode character '\xe6' in position 0: ordinal not in range(128) 
      

      Or the current kata issue is the other way:

      >>> b'\xe6'.decode('ascii')
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
      UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 0: ordinal not in range(128)
      
  • mauro-1 Avatar

    From description:

    The last line that will be executed of all derpcode programs is therefore herp a-derp..

    but the first sample test ("h") ends with herp derp a-derp.

    • beniolenio Avatar

      You shouldn't be executing code by that point. That code literally begins "derp a-derp." Then ends "herp a-derp."

      After you flip the zero bit, decrement the pointer, then print to output, you shouldn't execute any more code.

      Issue marked resolved by beniolenio 5 years ago
  • chucksys Avatar
  • Blind4Basics Avatar

    there is either an overspecification or a lack of test about the end of the program. Compare my solution with yours, for example. => is it possible to go to a negative index for the pointer at any other moment or not? If not, you should talk about it. If it can, that needs to be tested (in the random tests too)

    • beniolenio Avatar

      I wanted it to be possible, but Voile pointed out that the official language states that the negative cell value only exists for structural purposes (to end the code).

  • Blind4Basics Avatar
    • there is a her instead of herp in the input of the 10th test
    • you didn't tell in the description is the pointer is supposed to have changed after printing an octet to the "output"
  • Voile Avatar

    Sample test has syntax error: first line is missing " at the end.

  • Voile Avatar

    Needs random tests.

  • Voile Avatar

    Write the current bit and the next seven bits to stdout as an ASCII character.

    What is the bit order?

  • Voile Avatar

    There are infinitely many cells in each direction

    This directly contradicts the official documentation you linked to:

    The tape is left-ended, and initializes with all zero-valued cells. A tape[-1] cell exists for structural purposes only.