[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: computer-go: Sharing Go modules




Many Faces uses 0 for Black, 1 for White, 2 for Empty.

I use single dimension arrays. 0-360 are points (x+y*19), 361 is PASS, 362 is NO_POINT.

I have a separate array edge[363], which contains
the distance to the nearest edge, that I use for edge detection.

At 08:38 PM 5/16/2001 +0200, you wrote:
> I agree it's a good scheme. It's the same one that NNGS uses.
> Being able to address the neighbours of point pos as
> pos-Vdiff, pos-1, pos+1, and pos+Vdiff is quite a bit more convenient
> than dealing with (-1,0), (0,-1), (0,1), (1,0) vectors. Is it
> similarly standard to use 0 for EMPTY, 1 for BLACK, 2 for WHITE, and 3
> for EDGE ?

If BLACK is 0 and WHITE is 1 is easy to write code like

procedure DoSomething(p: boardoffset; color: boardcolor);
begin
  othercolor := 1-color;
  ...
end;

since one rarely want to deal with the colors explicetely. But this is
of course a rather minor point. It does not matter for the
performance because you only make this transformation once in
every procedure.

Magnus Persson
David Fotland