Re: [algogeeks] Re: suggest data structure

2011-03-25 Thread Akash Mukherjee
what about a graph, edges represent the paths allowed for the knight?? On Sat, Mar 26, 2011 at 12:51 AM, Gene wrote: > A knight can move 8 possible ways, so you need 3 bits to encode a > movement. > > To convert these 3 bits into relative motion on a board, define > integer board coordinates, th

[algogeeks] Re: suggest data structure

2011-03-25 Thread Gene
A knight can move 8 possible ways, so you need 3 bits to encode a movement. To convert these 3 bits into relative motion on a board, define integer board coordinates, then use a lookup table of (delta x, delta y) pairs to store the coordinate change of each possible move. All the elements of thes