You are still trying 2,673,216 possibilities, I think you can improve that.
Just an idea:
Initialisation:
Code:
/ * S
/ * *
* * * *
* * * *
* *
D /
x=5, y=0, 6 logs /, 6 logs \, Dir = down
Path calculation:
Code:
/ * S
/ * * #
* * * * #
* * * * #
* * #
D#########/
Solution not found, therefore, the first movable log encountered by the car must be somewhere in the sharps (#).
Loop the "sharp positions" try to replace them by either \ or /, recursion.
Example, I try to put a \ log in the (1,5) position. I assumed that it is the first log that the car will encounter. Therefore, there can't be an other log where a "S" stands. We move the car into the (1,5) position. The direction is now "up".
Code:
#/ * S
/# * * S
*#* * * S
#* * * * S
# * * S
D\SSSSSSSS/
x=1, y=5, 6 logs /, 5 logs \, Dir = up
The puzzle is not solved yet, therefore, the second log must be where a "#" stands. Loop the sharps, recursion.
I think I'll try something ^^ ...