Beta
Clue - Esoteric programming #4
23matt c
Loading description...
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
I don't understand the rules. Moving on.
Would you like some clarification on anything? I could then update the description to make this kata more friendly which would be great :)
I read several times the rule about 0 and 1 and went through the example, but could make sense of it. It is not clear why the
x
suddenly is at the right and then again at the left. But even why the sequence of 0 1 changes like it does in the example is not clear for me from reading the rules. I cannot really say what needs to be improved as I have no idea what this is supposed to do.If you read the reference is there anything I could move from there to here?
That is essentially the same text. Already at the first transition I don't understand why the x is not put after the zero as demanded by the end of the second rule.
do you want to write out an example so I can follow clearly?
OK, I finally managed to understand the rules. This is the information that I found missing:
cycle
method "must return the current iteration of the source code", it does not mean it should return the source code, but the number of times therun
method was executed on the initial program. This was not clear to me as the termiteration
is never explained in context, and when it says "iteration of the source code" it really sounds like a version of the source code.The notation with the
x
is not very clear. Looking back, it confused me. I would suggest using a^
on a line just below the string.I would suggest this text for the example section:
I just cleaned up the markup in the description a bit. I also added a line that explained that the last part was an example.
if there were issues could have notified me here and I could have fixed them too..
You're right, sorry about that. At first I just fixed the headers, so it was just markup. But I should have let you add the example notes. Will do next time! :D
This kata is pretty bad:
At its current state it's pretty much broken.
I have seen to your issues and fixed them.
Hi
matt c
,I would suggest you to improve the description a bit, because it is now confusing to solve the kata completely:
Kind regards,
D.
Hi @Dentzil, Please have a look, fix your translation: https://www.codewars.com/kata/number-number-pattern-number-number-wave/discuss#583b96551633815563000a31 Thanks ;-)
Hi
myjinxin2015
,fixed! ;)
I'm sorry, the programming language is (mostly) clear (would be better if iterations were clearly marked though, and did not flow over into each other), but the interface for the solution is obfuscated beyond normal comprehension.
I have no idea what property goes where or what the argument to run() means.
there is no argument passed into
run()
?? do you have any suggestions for the other fixes though?These are the example tests.
false
looks like an argument to me?Clue seems to work iteratively. You have a program, you do an iteration, you have a new program. The implementation could have been a function to do just that, but there's a class with more functionality.
I'm just unclear on what more needs to be done than iterating programs, and what the expected functionality of the provided methods is.
I'm a bit frustrated. And I probably sound like it. Sorry.
that was left from debugging, it means nothing.
and yes as I read it the program does not end until no more iterations can be completed so that's why you have to create a class which returns iterations of an input program.
Merde.
A cycle is not a complete iteration. It's just one step.
That would have been good to include in the Description, instead of having to dig for it on the external page.
Also, I am apparently doing something wrong. But I can't for the life of me figure out what. The example test don't help because they really only test zero cycles, and the submit tests don't help because they skip too many steps. The wiki page doesn't help because I'm bloody doing what's in the example there.
I'm stuck.
Hi
JohanWiltink
,which tests can you not pass?
Ehm, all of 'em, except
000000010000
which really only processes0
s.Here's some logging; first number is cycle, second number is pointer, then the (input - before the cycle) string with the to be processed element between
*
s:And then it only gets worse from there of course.
Hi
JohanWiltink
,ok, we see your algorithm works at least first 5 cycles correctly.
This is the good point to start to debug from 5th cycle.
According to "the language specification":
1 takes the next two characters ... The program pointer then moves to just beyond the second input that was read for NAND.
. Therefore the pointer in the 6th cycle (after move in the 5th cycle) must be at the index 2 (after adding new code item):6 2 11*1*1011010010110
Therefore your problem is in the shift of the pointer through the end of the source code.
And you should take into account that the shift occurs before the new code item is added.
I hope, it will help you.
When NAND, looking for its operands, runs off the end of the program, it starts again at the beginning ?!? I just took zeroes. Is this documented somewhere?
Exactly:
There is a program pointer that initially starts in the beginning of the string, moving forward after every instruction, returning to the beginning when reaching the end of the string
. Take a look here and here.That doesn't say where NAND gets its operands. But it is on that second linked page.
Having to dig for it not even on a page linked from the Description, but on a page linked from that page, sorry, hadn't thought that would be necessary (or useful).
Thanks.
You are welcome. ;)
Thanks Dentzil.
Is this kata still in draft? Cannot submit my solution.
it's not in draft.
post your solution below and mark as a spoiler, I'll see if it's something wrong with your code.
Still getting this message when I try to submit... No idea what's going wrong... :(
...while everything is okay in other katas
This comment has been hidden.
Your code does execute properly when I run it (it does fail tests however), try running it in firefox maybe? Also the interpreter isn't iterating
3
times, it iterates2
times, therun
returns the state of the string before it's processed so for example:The input has only been run against twice.
Then better modify your description. Moreover, at last I passed the final tests, with a dirty -- which I suppose dirty -- solution. There is a bug in your testing fixture.
And, I found out what caused the message I described above. It sounds strange but it was true that the testing code has run into an infinite loop. It should have prompted something like "it takes longer than 8000ms ...", assumed to be a bug of CW.
Sorry, the description still holds true, just the first time
run
is called you must return thesource
unprocessed because this if the first time you are using therun
there are examples in the default test cases which you could have inferred that from.Do you know exactly where the testing code was running into an infinite loop because when I ran mine I always ran.
I'm not sure. I will try to debug it when I come back. It need some time I think.
I can run my solution many times without timing out, I don't know what your problem is.
there was a bug in my code where the loop would stop if the user returned a falsy value. That has been fixed and your solution is invalid.
Okay, problem solved. I did it by preprocessing the code to make it look natural (in order to pass your tests :) ).