Earn extra honor and gain new allies!
Honor is earned for each new codewarrior who joins.
Learn more
  • I keep getting an error

    TypeError: Cannot read property '9' of undefined
        at transitionFunction (test.js:127:56)
        at machine (test.js:10:50)
        at Context.<anonymous> (test.js:144:21)

    when calling the transitionFunction, which is really annoying. My solution works for the given tests and I cannot see what is wrong with me calling the way I do.

  • Need more clarification on what types of attribute access to record.
    For example, I assumed access to init before calling it also needs to be recorded.

  • fixed.

  • minor typos:

    Your mission is to implement a turing machine emulator.

    For more information about turing machine: https://en.wikipedia.org/wiki/Turing_machine

    Turing is a proper noun, ao should have a capital T

    Operations to take using the trasition function


    new_symbol - A charachter to write at the current position


  • done

  • noted.

  • done

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

  • ( JS )

    T[[s,q]] = ...

    This. Is. Horrible.

    Object property keys can only be Strings. This syntax is valid, it's very, very Clever, and it relies on implicit coercion and it's completely unmaintainable. Also, I don't want to think about what happens when s or q happens to be ','. Or when T is a Map instead of an Object, which might at some point be a desirable optimisation.

    If you understand fully and completely when and how coercion works, and any and all collaborators agree this is a good idea ( with the same deep understanding of coercion ), and this behaviour is extensively, exhaustively documented, you might get away with it as long as nobody else ever needs to maintain your code. ( I would never ever want to be one of those collaborators. ) Given that the platform and the testing framework might at some point get upgraded and require maintenance on your testing code, and you might disappear from CodeWars and some poor sod other than you might have to perform that maintenance, please don't do this. It's begging for bugs, which might leave the kata non-functional at any moment.

  • Oh, and the transition function example has invalid syntax. This is needlessly distracting. Just use correct, complete, valid syntax.

  • ( JS )

    • A string. Initiated empty.

    This is confusing ( because it's actually easier to not do it with a String. I notice the example solution does this the same way I do it - not a String in sight ). This implementation detail should be left to solver.

    • A pointer to a byte in the string. Initiated with 0 (start of the string).

    It's not a byte, it's a character. It might be any datatype actually, but that would clash with the expected implementation of the tape.

    I'd suggest describing the "string" generically as "the tape", specifying that it's a sequence of characters, and that the return value of machine is to be a String.

    • Move the pointer left.

    For direction: 'r' ?!?

    Also, please use camelCase for identifiers. It's the accepted convention. And set Node 10.x as default.

  • You should also update the transition function's description

  • done

  • Description should be clearer (at least use more formatting).

    Function descriptions should be presented in the conventional way:

    def function(a, b, c):
      description of the input, output, etc.
      return d, e, f


    • Use the tra**_n_**sition function to ...
    • The operations are executaed in that order:
  • This was never ment to be a constraint. It was suoppose to be a guide of what the output should be.
    If this was confusing it is metter removed.

  • Loading more items...