wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
riddles >> hard >> Knight on an infinite chessboard
(Message started by: NickH on Apr 15th, 2003, 12:01pm)

Title: Knight on an infinite chessboard
Post by NickH on Apr 15th, 2003, 12:01pm
Consider a knight on an infinite chessboard.  How many squares can it reach after precisely n moves?

Title: Re: Knight on an infinite chessboard
Post by towr on Apr 15th, 2003, 1:09pm
it might be [hide]2^(2n+1)+n-1[/hide] but it's probably not..
(I only tried n=0,1,2 so far )

Title: Re: Knight on an infinite chessboard
Post by NickH on Apr 15th, 2003, 2:08pm
I would say f(0) = 1.  After no moves, it can only be on one square -- the square it starts from.

The knight can move back to a square it has moved from.

Title: Re: Knight on an infinite chessboard
Post by cho on Apr 15th, 2003, 2:22pm
It takes a few rounds to stabilize. It starts 1,8,33,76,129,196. From that point on each round grows by a number 14 greater than the previous. I'm not sure how to turn the whole sequence into one equation.

Title: Re: Knight on an infinite chessboard
Post by THUDandBLUNDER on Apr 15th, 2003, 4:20pm

Quote:
It takes a few rounds to stabilize. It starts 1,8,33,76,129,196. From that point on each round grows by a number 14 greater than the previous. I'm not sure how to turn the whole sequence into one equation.

I'm not sure what you mean there, cho.

Do you mean f(n) - f(n-1) = 14n + some constant ?

OR

Do you mean f(n) - f(n-1) = 14 ?

OR

Perhaps you mean something else?

Why 14?

How did you get your sequence?

Title: Re: Knight on an infinite chessboard
Post by cho on Apr 15th, 2003, 6:13pm
Okay, I'm going to show my utter lack of math skills here. By instability I mean that moves 1 and 2 don't fit the pattern. If they did the sequence would be
1,12,37,76,129,196,277,372,481...
Notice that the difference between adjacent values is
11,25,39,53,67... There's the 14.
The pattern is obvious, but my last math class was a basic algebra class in high school 30 years ago.
How I got my sequence was by counting (very little math required). I took a piece of graph paper and marked out the possible locations for one quadrant and multiplied by 4:
0
3212343456567878
214323454567678 8
3232343456567878
232343454567678 8
3434345456567878
434345456567678 8
5454545656767878
454545656767878 8
56565656767878 8
6565656767878 8
767676767878 8
67676767878 8
7878787878 8
878787878 8
8 8 8 8 8
8 8 8 8 8

Title: Re: Knight on an infinite chessboard
Post by cho on Apr 15th, 2003, 6:20pm
I'm also assuming the question seeks the number of squares you could be sitting on on the Nth move, and not all the squares it has touched so far (only the same colored squares as the original square after an even number of moves, eg)

Title: Re: Knight on an infinite chessboard
Post by Chronos on Apr 17th, 2003, 4:51pm

Quote:
Personally, I think the function is more likely to be linear than exponential.
After a given number of moves, a knight can (approximately) reach any square within a "circle" of radius proportional to the number of moves.  The number of squares in that "circle" is approximately the area of the circle.  So it makes sense that, asymptotically, at least, the function would be quadratic.

Which is exactly what cho found, so this post is rather redundant now...

Title: Re: Knight on an infinite chessboard
Post by Netman on Apr 23rd, 2003, 6:59pm
For the version where the knight cannot revisit squares... after wasting 12 CPU minutes bruteforcing the problem, I came to the realization that the only square that restriction eliminates is the starting square, all other squares can be reached via some sequence of moves.

So the equation:
f(n) = 7n2 + 4n + 1, if n > 2
holds for all odd n, and for even n, just subtract one for the starting square.

Chris

Title: Re: Knight on an infinite chessboard
Post by THUDandBLUNDER on Apr 24th, 2003, 10:36am
But the original square is already included. That is, f(0) = 1.

Let's generalize the question:

Consider a knight moving on an infinite chessboard.
How many squares can it arrive at after precisely n moves given that:

1) it can double back and re-visit squares?

2) it cannot double back and re-visit squares?

3) we also count every square that it has visited?

Also, 4) how many for n or less moves?

1) is the original question. You are suggesting that 1) and 2) are the same sets, which seems doubtful to me.
Have you written a program? However, 3) and 4) would appear to be identical. [i][/i]

Title: Re: Knight on an infinite chessboard
Post by cho on Apr 24th, 2003, 11:27am
In #2, of course, you can never end up back at square one because it's been visited, but any other square that can be reached can be reached without using a square twice.
For example: Move 1 could put you at 2,1 from the start. Move 3 could put you there by going 2,-1; 4,0; 2,1. For any square you want to reach 2 or 4 or 6 or 8 moves after the move that would most quickly put it there, you just move 1 or 2 or 3 or 4 moves beyond it and come back on a parallel route.
Your #3 is just each number added to the previous term in the series. Even I can do that math: 14x2-6x+5.



Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright 2000-2004 Yet another Bulletin Board