20x22 is also a popular choice, since in a single dimension array a single entry worked for other off-right and off-left points. Goliath used this. I didn't have any real reason to use 19x19 other than smaller size, since the whole program had to fit in 640 KB :(
I have an array of offsets to adjacent points, so I avoid generating indexes off the edge, without extra comparisons. I don't use functions to convert 0-n to x, y. I use arrays of constants instead. It's faster. David > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Darren Cook > Sent: Friday, July 20, 2007 5:17 PM > To: computer-go > Subject: Re: [computer-go] Go datastructures > > > > I always used a 1-dimensional 25x25 = 625 integer array with 0 for > > black 1 for white 2 for empty and 3 for border (everything else). > > > > This way I can have a 21x21 board with 2 rows of border cells > > surrounding it. > > David Fotland, on the other hand, seems to use a 19x19 grid, > and detect off-board separately. (?) > > This is the way I've also always done it. I get round the > speed issues of off-board detection because I have a global > singleton called APD (Adjacent Point Data). Its constructor > caches lots of results. E.g. it has functions to turn a 0..N > coord into x and y coords, functions to rotate points, > functions to return the coord a certain distance away (e.g. > ikken to the North, keima to the South-East). That latter > function returns a special value when off-board. > > APD also has functions for looping (e.g. through all the > adjacents, or all the diagonals, or even all the ogeima; > automatically skipping over off-board), for measuring > distance to nearest edge or nearest corner, and for point > "type" (corner, edge, centre). > > But, still, I wonder if the N+1 x N+1 design is quicker. > > Darren > > _______________________________________________ > computer-go mailing list > computer-go@computer-go.org > http://www.computer-go.org/mailman/listinfo/computer-go/ > _______________________________________________ computer-go mailing list computer-go@computer-go.org http://www.computer-go.org/mailman/listinfo/computer-go/