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.
descriprion updated
Sorry, you're right.
code returns 'E' for that input
But it's valid. Can you explain why it's invalid, providing more proof than 'it seems so' ?
Fixed
!(whew)
Indeed it has been straightforward...
Just needed to generate the message length before checking and shortening the key...
Won't believe but also did run more than
five million test cases
on my platform... The report counts2 000 0036 lines
and takes the place on disk897M
.Here is just its little part:
Will be surprised but it takes only
fifteen seconds
to run the whole test!:o
So did run it several times...
(chuckle)
(*)
To resolve the issue @csoviii did report without forking...
Please, Could you change the line 157:
nchar = ge_uint(k, NCHAR);
tonchar = ge_uint(k, NCHAR-2);
?This is the consequence that i did miss two extra characters while generating mirror keys which decided to add as usual at the last moment... (facepalm)
But the problem with Mirror keys remains in the Random Test cases...
So it also needs to be refactored...
JS does not seem to be buggy! In this particular case it just has another concept of keys especially as i did say when the length is same both for the key and the message...
Fixing...
It seems you spent a lot of time on it :) Thanks!
The original idea was :
And it should return
1939
key - the shortest possible key.It was a long time ago and my JS skills were pathetic at that time too ;) If you think it's bugged in JS, I'll check it. Let me know.
Report
:Did some research and found the thing more serious...
It seems there are some concept misunderstandings...
Try to do my best to explain!
But let's consider:
1212
or123123
and so on to beCYCLIC
orPERIODIC
keys121
or1231231
or12312312
and so on to beMIRROR
keys112
or1111113
and so on to beALONE
keysSo mainly it regards the keys where the first digit matches the last one and the length is the same for both the key and the message and also the keys having its digits repeated partially which i did call
MIRROR
keys!Let's consider some examples:
Here the translations return
123456
but should return the key1234561
because the key isNOT CYCLIC
butMIRROR
and if continued to be used should generate the code:And
NOT this one
which iswrong
if considered to beCYCLIC
:So the opinion here is that the key should have been
shortcut ONLY
if it isCOMPLETELY CYCLIC
.Otherwise, if partially repeated
MIRROR
one shouldreturn as-is
!Mainly the problem surfaced because the C generator tries to test for the different types of keys but the C solution implementation and the Generic Test set cases relied on the JS Translation and here the implementation is wrong but valid because of not being tested comepletely...
So what's the decision?
Reviewing...
Thanks!
Thanks! It's @uniapi 's translation. I hope he'll check it.
What language?