<ahref="https://en.wikipedia.org/wiki/Knight%27s_tour">Knight's Tour</a>Problem: You have an empty <code>w</code> * <code>h</code> 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 <i>not</i> a requirement that the tour be "closed"; that is, the knight need not end within a single move of its start position.
</section>
## Instructions
<sectionid='instructions'>
Write a function that takes <code>w</code> and <code>h</code> as parameters and returns the number of initial positions from where it is possible to achieve the task stated above.
</section>
## Tests
<sectionid='tests'>
``` yml
tests:
- text: <code>knightTour</code> should be a function.
testString: assert(typeof knightTour == 'function', '<code>knightTour</code> should be a function.');
- text: <code>knightTour(6, 6)</code> should return a number.
testString: assert(typeof knightTour(6, 6) == 'number', '<code>knightTour(6, 6)</code> should return a number.');
- text: <code>knightTour(6, 6)</code> should return <code>35</code>.
testString: assert.equal(knightTour(6, 6), 35, '<code>knightTour(6, 6)</code> should return <code>35</code>.');
- text: <code>knightTour(5, 6)</code> should return <code>20</code>.
testString: assert.equal(knightTour(5, 6), 20, '<code>knightTour(5, 6)</code> should return <code>20</code>.');
- text: <code>knightTour(4, 6)</code> should return <code>10</code>.
testString: assert.equal(knightTour(4, 6), 10, '<code>knightTour(4, 6)</code> should return <code>10</code>.');
- text: <code>knightTour(7, 3)</code> should return <code>4</code>.
testString: assert.equal(knightTour(7, 3), 4, '<code>knightTour(7, 3)</code> should return <code>4</code>.');
- text: <code>knightTour(8, 6)</code> should return <code>47</code>.
testString: assert.equal(knightTour(8, 6), 47, '<code>knightTour(8, 6)</code> should return <code>47</code>.');
```
</section>
## Challenge Seed
<sectionid='challengeSeed'>
<divid='js-seed'>
```js
function knightTour(w, h) {
// Good luck!
}
```
</div>
</section>
## Solution
<sectionid='solution'>
```js
function knightTour (w, h) {
var b, cnt=0;
var dx = [ -2, -2, -1, 1, 2, 2, 1, -1 ];
var dy = [ -1, 1, 2, 2, 1, -1, -2, -2 ];
function init_board()
{
var i, j, k, x, y;
// * b is board; a is board with 2 rows padded at each side
for(i=0;i<h;i++){
for(j=0;j<w;j++){
b[i][j]=255
}
}
for (i = 0; i <h;i++){
for (j = 0; j <w;j++){
for (k = 0; k <8;k++){
x = j + dx[k], y = i + dy[k];
if (b[i][j] == 255) b[i][j] = 0;
if(x >= 0 && x <w&&y>= 0 && y <h)b[i][j]++;
}
}
}
}
function walk_board(x, y)
{
var i, nx, ny, least;
var steps = 0;
// printf(E"H"E"J"E"%d;%dH"E"32m[]"E"m", y + 1, 1 + 2 * x);