what about a graph, edges represent the paths allowed for the knight??

On Sat, Mar 26, 2011 at 12:51 AM, Gene <[email protected]> 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, then use a lookup table of (delta x, delta
> y) pairs to store the coordinate change of each possible move.  All
> the elements of these pairs are +-1 and +-2.
>
> The current board position of a piece is just an (x,y) coordinate.
> One such pair is enough for a single knight.
>
>
> On Mar 24, 8:49 am, snehal jain <[email protected]> wrote:
> > Design a data structure to represent the movement of a knight on a
> > chess board.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to