Legal Moves in Go (ADU Feb 20)

Legal Moves in Go (ADU Feb 20)

a WimpyPoint presentation owned by Mark Dettinger

Legal Moves in Go


How to solve it

Let's assume a black stone is placed on field X.

How do we determine the liberty of a group?

For our purposes, it suffices to determine whether the liberty is zero or positive. We don't care about the actual number.

Preventing an infinite loop


Preventing an Array-Index-Out-Of-Bound Error

Instead of accessing the board matrix directly, use a wrapper function.
char board[MAX_SIZE][MAX_SIZE];

char get_color (int i, int j, char default)
  if (i>=0 && i<n && j>=0 && j<0) {
    return board[i][j];
  } else {
    return default;
Instead of accessing board[i][j], call get_color(i,j,default).

Last modified 2001-02-20

Mark Dettinger