[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [computer-go] Core data structures: modify or copy?
On 5/15/05, Peter Drake <drake@xxxxxxxxxxxxxxxxx> wrote:
> I'm once again playing with the core data structures in my Go program.
>
> There must, of course, be a data structure to represent the board.
> If there is to be any kind of search, there are two options:
>
> 1) Maintain only one copy of the board, making and undoing all moves
> here.
> 2) Make a new copy at each node.
>
> #1 might require some extensive winding and unwinding, especially in
> a best-first search such as proof-number search. #2 uses a lot of
> time copying (or rederiving) information on blocks, liberties, etc.
There exists a "third way" in which you make a new interface (level of
indirection) to the existing data. Accesses to unchanged positions are
passed through and accesses to changed data are handled in the
interface. If you derive information on blocks etc in the right way,
you can also reuse a great deal of that.
cheers
stuart
_______________________________________________
computer-go mailing list
computer-go@xxxxxxxxxxxxxxxxx
http://www.computer-go.org/mailman/listinfo/computer-go/