Am 13.07.2009 um 17:36 schrieb Carter Cheng:


Hi,

I have again been considering trying my hand at implementing a simple go program. The question I have pertains to checking for the edge of the board in capture situations and so on. For a modern CPU (given what limited information I have on this) the extra branches might result in pipeline stalls if I am constantly checking if values are in range. Is it best to extend the size of the board to say 21x21 to somehow avoid these sorts of checks? Or are the relative cost of these branches negligible in the scheme of things?

Thanks in advance,

Carter.

If you have a 1d array, a 20*21+1 array is enough. the right edge is the left edge. There was an ascii image that illustrates it, but I can't find it right now...

You can also precalculate the neighbour coordinates for each position, and reserve a special coordinate for the "border". Just make sure to recalculate these when resizing the board.

I don't know how fast it is to check each value if it is in range, but I think making the board a bit bigger is faster.

Isaac
_______________________________________________
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/

Reply via email to