Hi

Tarek,

Nice puzzle.

If I convert your visual puzzle in to numeric values then it looks like as follows:

- Code: Select all
`030000000000024000000000000000000`

-99-99000-12-99000000040008000000

031000000-99-99000-99-99000-99-99

-99-99000000000000-99-99000000000

000000-99000-99-58018000000-10-99

081000-99044-99000-99000-99000-01

000000-99000-99000000000-17+12-99

-99+10000000000000-99-99000000000

000000-37-99-99000-99+23000-99-99

-99-99000+10-99070000000000-79004

000000000000000000000062000000052

Whereas:

1) each three digits represent a cell;

2) 000 in a cell means empty cell;

3) -99 in a cell means a thief in a cell;

4) +/-02 to +/-98 in a cell means to jump forward/backward towards aero head cell;

5) -1 means starting cell position; and

5) 81 means finishing cell position.

If a brute-force backtrack solver be written, then it will create another single dimension array of 81 elements that will represent move wise cell position as follows:

- Code: Select all
` 65, -1, -1,109, -1, -1, -1, 19, -1,`

-1, -1, -1, -1, -1, -1, -1, 74, 50,

-1, -1, -1, -1, -1, 4, -1, -1, -1,

-1, -1, 0, 22, -1, -1, -1, -1, -1,

90, -1, -1, 18, -1, -1, -1, 58, -1,

-1, -1, -1, -1, -1, -1,120, -1, -1,

-1, -1, -1, 49, -1, -1, -1, -1, -1,

-1, -1, -1, -1, -1, -1,104, -1, -1,

-1, -1, -1, -1, -1, -1,108, -1, 55

Whereas:

1) first number represent starting zeroth move cell;

2) last number represent finishing end move cell; and

3) -1 represent to be searched cell position for specific move number.

a pseudocode should be, check from starting move cell position to each 8 positions for next move as follows:

1) Top-Right by subtracting 10 from cell position;

2) Right by adding 2 to cell position;

3) Bottom-Right by adding 12 to cell position;

4) Bottom by adding 11 to cell position;

5) Bottom-Left by adding 10 to cell position;

6) Left by subtracting 1 from cell position;

7) Top-Left by subtracting 12 from cell position; and

8) Top by subtracting 11 from cell position.

Note:

1) after adding above value:

a) if cell position exceed from [INT (cell / 9) + 10] value then subtract 11; and

b) if cell position still exceed 120 value then further subtract 120.

2) after subtracting above value:

a) if cell position decreased from [INT (cell / 9)] value then add 11;

b) if cell position still decreased from 0 value then further add 120.

1to9only wrote:so (79)r10c10 - (80)r8c10 - (81)r6c1 in one likely exit route.

Similarly, some more possible move cell positions are as follows:

Move / Cell: 1 / 87, 2 / 85, 3 / 107, 59 / 71, 60 / 93, 61 / 115.

R. Jamil