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.
Are you sure? b7 to a8 return 4.
If begin OR end position is a corner point (A1,A8,H1,H8) AND BOTH row and col are 1 step, we've a minimum of 4 moves.
This covers the moves A1-->B2; B2-->A1; H1-->G2; G2-->H1; A8-->B7; B7-->A8; H8-->G7; G7-->H8
For all other 1-1 moves, you will not fall in the second IF case and it returns 2 moves.
I play with the ASCII value: 'a' = 65, 'b' = 66... 'h' = 72; '1' = 49, '2' = 50,... '9' = 57
It doesn't matter if we move from a to b or b to a as ABS(66-65) == ABS(65-66) == 1; same for the digits.
Need extra test case...
do_test("ADAD", "BCBC", false);
ExOR approaches are passing on current test cases.
Brilliant solution, one to remember!