Knight's Challenge in D
Chris R. Miller
lordSaurontheGreat at gmail.com
Thu Apr 3 08:01:33 PDT 2008
Tower Ty Wrote:
> Interesting
>
> Your access array is as so
> const int[8][8] access=[
> [2, 4, 6, 6, 6, 6, 4, 2],
> [4, 6, 8, 8, 8, 8, 6, 4],
> [6, 6, 8, 8, 8, 8, 6, 6],
> [6, 6, 8, 8, 8, 8, 6, 6],
> [6, 6, 8, 8, 8, 8, 6, 6],
> [6, 6, 8, 8, 8, 8, 6, 6],
> [4, 6, 8, 8, 8, 8, 6, 4],
> [2, 4, 6, 6, 6, 6, 4, 2]
>
> Just taking the first line which explains the side squares of the board I can only see 3 legal moves on each tile you show 4 , and 4 on each tile you show 6. So what am I not seeing ?
What you're seeing is my typo. I typed that down from memory, something I worked out almost four years ago. Apparently my memory isn't as good as I'd like it to be.
Now that I look at that matrix, I'm seeing errors that I didn't notice that could significantly change the performance of my algorithm. I'll have to fix that when I get home (and to my compiler).
I think it should be:
const int access[][]= [
[ 2, 3, 4, 4, 4, 4, 3, 2],
[ 3, 4, 6, 6, 6, 6, 4, 3],
[ 4, 6, 8, 8, 8, 8, 6, 4],
[ 4, 6, 8, 8, 8, 8, 6, 4],
[ 4, 6, 8, 8, 8, 8, 6, 4],
[ 4, 6, 8, 8, 8, 8, 6, 4],
[ 3, 4, 6, 6, 6, 6, 4, 3],
[ 2, 3, 4, 4, 4, 4, 3, 2]
];
I have the original matrix I used in C fromm all those years ago stored away somewhere. The defining feature of a good backup is inaccessibility, so it only follows that I can't find it. Thanks for the catch. I'll probably patch my algorithm and then only bother to regenerate the SVGs when I get a script to generate the Wiki page as well - last time I had to write in each image link by hand, which wasn't fun.
More information about the Digitalmars-d
mailing list