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.
I set my max to 1.2e6 and it works.
It may not look make sense at all, think of it like something only JavaScript can do.
.
This comment is hidden because it contains spoiler information about the solution
Take a look at the test example and its diagram. There are a total of 6 columns and 8 rows. Each column represents the space between the vertical rails. This means there are a total of 7 rails and 7 elements (the numbers
0
through6
at the top, one for each rail) whose positions start in ascending order.The first row is
001001
, which means there will be two horizontal crossbeams at this row; one between the vertical rails2
and3
and another between vertical rails5
and6
. This means that the elements positioned at these connected vertical rails will swap vertical rails and proceed to move down.Each time there is a horizontal crossbeam, the elements going down the connected vertical rails will swap rails. In the diagram, the grey markers on the left indicate the position of each row.
If this doesn't clarify, then perhaps the linked Wikipedia article in the Description may help.
Take a look at the examples anyway. And types.
0xFFFF - input (input types specified by function signature).
"FFFF" - output (4 bytes);
0x7F - input (input types specified by function signature).
"7F" - output (2 bytes);
Read in the table statements like "HEX ASCII".
And pay attention to quotes sign
e.g: "0000"..."FFFF"
Or statement like "HEX"
And 0..FF, no quotes sign, therefore it's 1 byte number.
The state should always be 2 bytes. Yes, if value consist of a single digit it should be padded with zero. "00"..."7F" therefore even if passed state is zero, you should write "00" to packet.
In the examples in the second test case it is padded, it's just hard to see.
"\x02""FFFF 7F FFFFFFFFFFFF 999999 FFFF\x03\xD7"
"\x02""0000 00 000000000000 000000 00FF\x03\x24"
Well, then try it out on your own computer.
You can use strings from basic tests to compare your output, CRC value visible there.
You should be able to use "printf" even when solving katas.
And you can use a static value of crc, in example tests if you will look at the end of example packets you can see a CRC value like "\xD7" in "\x02""FFFF7FFFFFFFFFFFFF999999FFFF\x03\xD7" packet.
Yes, a zero is a valid value of crc.
P.S. use provided 'crc8' function.
Thats a mistake. I will correct ASAP. Thanks.
I added an additional description for kata.
Yeah, you are right.
Maybe you should put that in the descriptions :)
Loading more items...