[computer-go] Fast inner loops in Go
Anders Kierulf
anders at smartgo.com
Fri Sep 1 14:25:42 PDT 2006
> Many Faces does something similar. I keep linked lists of
> neighbor points by color (black, white, and empty), so if I
> want to find the black neighbors, I just walk one list, with
> no test in the loop.
>
> David
Linked lists of neighbors of each color make the inner loops fast, but I
suspect you're paying a higher price when adding or removing stones, as
removing a point from a linked list usually involves a loop. You'll also
have to update two lists each time. Using a bitset to denote the neighbors
avoids that loop, and does both the adding and removing in one operation.
Anders Kierulf
www.smartgo.com
More information about the computer-go
mailing list