Author: William H Rogers
Date: 15:43:39 01/22/02
Go up one level in this thread
You seem to be confused about a 10x12 board. Edge detection for knight is there.
Let me show you what I mean.
30|31|32|33|34|35|36|37|38|39
40|41|42|43|44|45|46|47|48|49
xx| |xx
off board | |off board
A compute chess program sees an array as one long string such as:
30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49
xx |xx|xx| |xx
We bend it into a square so that if you have a knight on square 38 and try
to move two squares to the right you end up at square 40 which is off the board.
Only at the ends of the chess board do we add an extra row of xx'x.
Early programmers used to make the same mistake, thinking that they needed a
12x12 board, because they did not consider that real computer chess is really
one real long string of numbers, we just perceive it differently.
There are other representations, but do not confuse this one as it makes
generating moves very easy: Up and down +10, -10. Left and Rigth +1, -1.
Bishops are +9, +11, -9, -11 as are pawn captures. The knight is a littel
different, but I think that you can figure that out.
Bill
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.