www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Knight's Challenge in D

reply Chris R. Miller <lordSaurontheGreat gmail.com> writes:
Tower  Ty Wrote:

 Good stuff Chris
 I got one to run at least and found the original problem. I followed your
advice and the first time I got 2 .svg files . The first of which worked and
looked good . The second gave me an array out of bounds error.
 I'll have a closer look in a few hours as I have to go out but I'll chuck it
in here anyway in case you spot it immediately. This was the second try which
ave out of bonds on the first.result.

[snip!] Well, naturally I was quite amazed that it made an error on what looks like good output. However, then I looked closely. You have two linefeeds in between solution sets. I cut it down to one, and it ran just fine. The issue is due to the parser making a blank board in the event that it finds two newlines in a row. It then tries to treat it like a normal board with things in it. When it tries to snip a trailing space off of the end of an array, it tries to find an array index at -1. I'll be patching the source file shortly to fix that little bug. Thanks for the catch. Also of note, since you made some comments about freedom of speech, I decided to try and open up both the ticket system and forum to unregistered users. The people on the Trac site have their ticket system open to everyone, so that can't be all too bad. The forum I'm not so sure about, but I just reasoned that I'll leave it open until the first spambot targets it. Thanks for that input, it's really helping make the site better.
Apr 02 2008
next sibling parent Tower Ty <tytower yahoo.com.au> writes:
That was it Chris Thanks 
Now to go study what you did.
Good Luck
Apr 02 2008
prev sibling parent Tower Ty <tytower yahoo.com.au> writes:

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 ?
Apr 03 2008