'determine if the given action (x,y tuple) is a legal move
note: we only check ko, not superko at this point (TODO?)'

def is_legal(self, action):

    if (action is PASS_MOVE):
        return True
    (x, y) = action
    if (not self._on_board(action)):
        return False
    if (self.board[x][y] != EMPTY):
        return False
    if self.is_suicide(action):
        return False
    if (action == self.ko):
        return False
    if (self.enforce_superko and self.is_positional_superko(action)):
        return False
    return True
