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.
In C++ for some reason random tests fail but when I put the string used in the failing random test as a sample test it works, does anyone know what causes that?
The precedence of
=
is lower than that of+
. You should be parsinghijwpyk = 73 + 44
ashijwpyk = (73 + 44)
not as(hijwpyk = 73) + 44
.It looks like the error message has the "expected" and "received" backwards -- that is, your code said 73, but the expected value is 117.
Your C# "tokenize" method is a mess. For some unknown reason it adds closing parenthese ")" to the end of the input. Also, the regex is a complete mess too, it does not parse numbers at all and there are other issues with it.
Why even have such starting code if it is wrong?
OP solved it, closing.
To those that get inexplicable precision problems: your code most likely has a conversion of double to float at some point(like the modulo operator) and loses precision.
You must throw an exception in cases like referencing an undeclared variable or an input that doesn't evaluate to an expression
Look at how the last basic test works, it expects a throw when trying to get a non-existent "y"
C++
What is the meaning of this test failure:
Expected: equal to "Error caught"
Actual: "Error not caught"
How perform operations between numbers and functions
x * function x y
function x y * y
and function and function
functionA x y * functionB y x
Looking at this kata but haven't tried it yet. That said, the parser would know how many parameters the function needs when it sees its name. Thereby knowing how many expressions to parse to be able give it the parameters it needs. Keeping in mind that an expression would continue to parse as long as it possibly can and still being a valid expression. Thus the parser would parse two subsequent expressions (resolving "2 + 5" and "3" respectively) and give them to the function, evaluate it, and continue on.
It will not stop at just the "2", because "2 + 5" is a valid expression; it will however stop there, because "2 + 5 3" is not a valid expression (as per the grammar).
I hope that makes sense.
Definetly a Tough Kata, but worth it. I learned a lot from this one :D
This comment is hidden because it contains spoiler information about the solution
I don't know if you've solved it yet, but you just have to throw an exception, any.
The Interpreter can continue after that.
Looks like not all inputs are displayed in log for C#.
For example in "conflicts" tests i can see only:
But with
Console.WriteLine(input)
i can see:Also in "variables" tests in log i can see
input("y") == <> and not <25> => wrong solution, aborted!
But in previous "function" tests with
Console.WriteLine(input)
(not in default log) i can seeSo I thought there should be different scopes for different sections of the tests. If not, then the answer in "variables" tests should be
y = 25
Can anyone tell me how the remainder of the division is implemented in the tests?
Thanks for the answer, but I use 'double' everywhere. I suppose the problem is the verification
Loading more items...