Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Issue with the PHP tests:
These incorrectly replace multiple consecutive input or output characters (
,
&.
) with just a singleputchar
/getchar
call.This is incorrect, as while reading multiple bytes from input would only store the last, it would still consume multiple bytes.
Same goes for the output: the written character would be the same each time, but it would still be written twice.
(The interpreter in the tests would print
Helo, World!
, with just a single 'l', for example).I could get my solution to pass by implementing the same error, but that is obviously not right.
Edit: Just noticed hotdonkey already reported this 9 months ago...
For the C translation, the tests expect us to return a newly-allocated character string, but never frees it. I know it doesn't free it now because the initial solution returns a statically allocated string instead and doesn't break the allocator.
A change to the function's interface or the initial solution would allow the tests to free the returned string instead of wasting that memory.
The tip for C: more memory,very more
In description it is told that repeated "." and "," commands must act like repeated commands
Example:
".." -> "putchar(*p);\nputchar(*p);\n"
However to pass random tests i had to combine them to one.
"...." -> "putchar(*p);\n"
So there is either missleading description or tests.
What difference does it make if my algorithm, as a result of calculations, replaced this sequence "+<->" with a similar one "<->+" ? Or this "<<--<-<+>--+" (8 lines in C) to the optimized "<<--<--<+>" (7 lines in C) ?
Why is kata hardcoded to one C variant, not realizing that other variant (smaller or equal in number of lines) can lead to the same calculation results? O_o
Can't stop getting timeouts for the c++ version.
I'm 99% sure it's not my fault because even when I immediately return std::string() from the function, I still timeout even though my function is doing absolutely no calculation. All the other tests pass perfectly fine and on my machine at home a 10k brainfuck source code computes in like 30 milliseconds
Simply returning an empty string immediately still times me out.
Shall I suggest that this kata expected result is 'suboptimal' ??
My attempt passes the fixed tests, but the for some random test the expected contains
"... *p += 2; *p -= 1;..."
where my solution gives "..*p+=1;..." for those same both lines ??
C++ version should probably accept
source_code
parameter asconst std::string&
instead ofstd::string
I'm having an issue in the last performance test. It says "The translation was failed. - Expected: true, instead got: false" and the input it's "[[>?-+<]]..." repeated many times. What would be the expected output in this case? My solution is outputting the following:
Not sure what I'm missing here.
Random tests in JavaScript are problematic because the user does not get to see the expected answer, meaning even if we log the input and process it line by line, we cannot see what the checker expects. In some cases it is clear the checker is rejecting a demonstrably correct solution.
That being said, nice kata. To the people saying it requires too much performance for a level 4 kata, I wouldn't agree, you should just try various methods of parsing until you find the most efficient one possible.
This comment is hidden because it contains spoiler information about the solution
Kotlin translation, would someone mind reviewing this please.
This comment is hidden because it contains spoiler information about the solution
The python version trims the expected output so much that it's impossible to debug.
My C++ solution is failing with the following status (it passes basic sample tests and is indicating "General Tests" in green as well:
Time: 2038 ms Passed: 1 Failed: 0 Exit Code: 139
and an error which reads:
test: ../../libcxx/include/string:1164:
void std::__1::__basic_string_common::__throw_length_error()
const: Assertion `!"basic_string length_error"' failed.
It would appear that either I'm trying to use negative length strings (already checked there's no chance) or that the maximum C++ string size has been exceeded.
Can someone enlighten me on the possible causes of the error?
I'd also appreciate if someone could point me to where I can find a reference to what Exit Code: 139 means.
Loading more items...