There has been a question regarding the correct output for the UDF. The output is supposed to be a three-dimensional array [x,y,z] where the [x,y] dimension are the initial puzzle, intermediate steps, or final solution. The [z] dimension represents the steps taken to get from the initial puzzle to the final solution.

Below is a sample UDF that generates such an array with the solution for the first test, though the steps/solution is hard-coded and works for the first test ony. Additionally, there is commented out code in the scoring engine labeled "display the results" that then prints the array such that you can see how one got from the initial puzzle to the final solution. Just uncomment that section to see your output displayed.

 Code:
; begin KiXgolf UDF
;
;!
Function S($)
  dim $a[3,3,5], $sInput, $ix, $iy

  for $iy=0 to 3
    for $ix=0 to 3
      $a[$ix,$iy,0] = $[$ix,$iy]
    next
  next

  $sInput = 'xx41|xx23|4132|3214'
  for $iy=0 to 3
    for $ix=0 to 3
      $a[$ix,$iy,1] = substr($sInput, $iy*5 + $ix + 1, 1)
    next
  next

  $sInput = 'x341|xx23|4132|3214'
  for $iy=0 to 3
    for $ix=0 to 3
      $a[$ix,$iy,2] = substr($sInput, $iy*5 + $ix + 1, 1)
    next
  next

  $sInput = '2341|xx23|4132|3214'
  for $iy=0 to 3
    for $ix=0 to 3
      $a[$ix,$iy,3] = substr($sInput, $iy*5 + $ix + 1, 1)
    next
  next

  $sInput = '2341|x423|4132|3214'
  for $iy=0 to 3
    for $ix=0 to 3
      $a[$ix,$iy,4] = substr($sInput, $iy*5 + $ix + 1, 1)
    next
  next

  $sInput = '2341|1423|4132|3214'
  for $iy=0 to 3
    for $ix=0 to 3
      $a[$ix,$iy,5] = substr($sInput, $iy*5 + $ix + 1, 1)
    next
  next

  $S = $a

EndFunction
;!
;!
; end KiXgolf UDF
_________________________
There are two types of vessels, submarines and targets.