w
* h
chessboard, but for a single knight on some square. The knight must perform a sequence of legal moves that result in the knight visiting every square on the chessboard exactly once. Note that it is not a requirement that the tour be "closed"; that is, the knight need not end within a single move of its start position.
w
and h
as parameters and returns the number of initial positions from where it is possible to achieve the task stated above.
knightTour
should be a function.
testString: assert(typeof knightTour == 'function');
- text: knightTour(6, 6)
should return a number.
testString: assert(typeof knightTour(6, 6) == 'number');
- text: knightTour(6, 6)
should return 35
.
testString: assert.equal(knightTour(6, 6), 35);
- text: knightTour(5, 6)
should return 20
.
testString: assert.equal(knightTour(5, 6), 20);
- text: knightTour(4, 6)
should return 10
.
testString: assert.equal(knightTour(4, 6), 10);
- text: knightTour(7, 3)
should return 4
.
testString: assert.equal(knightTour(7, 3), 4);
- text: knightTour(8, 6)
should return 47
.
testString: assert.equal(knightTour(8, 6), 47);
```