Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Knight jumps

Author: Kolss

Date: 08:13:45 11/17/05

Go up one level in this thread


On November 17, 2005 at 11:02:35, Uri Blass wrote:

>On November 17, 2005 at 10:18:59, Kolss wrote:
>
>>On November 17, 2005 at 09:29:39, Jarkko Pesonen wrote:
>>
>>>Is there any simple algorithm to calculate
>>>how many jumps it takes for knight to get some specific square?
>>>
>>>Or any simple precalculated table structure.
>>>
>>>Thanks
>>>
>>>Jarkko Pesonen
>>
>>Hi,
>>
>>It depends a bit on your data structures. E.g., in 0x88, you can precalculate an
>>array 0..127 (119), and store the number of moves a knight needs to get from
>>square1 to square2 in array[Abs(square1 - square2)]. I.e., it takes the same
>>number of moves from a1 to d6 as it takes from b1 to e6 or from a2 to d7 or from
>>d6 to a1,
>
>This is correct but you can go from b2 to c3 by 2 moves b2->d1->c3 when you
>cannot do it from a1 to b2
>
>Uri

Oh, cool - you are right, of course! That makes it quite a bit harder to find
something elegant, I guess...

Munjong.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.