k, got my computer at hand.
nobody seems to listen when I say iif() is bad...

 Quote:

Your solution passed all tests

KiXtart
KiXtart Version = 4.53
KiXGolf Script = kixgolf_ls.kix

Computer
OS = Windows XP Professional
CPU = AMD Turion(tm) 64 X2 Mobile Technology TL-64
Speed = 2194 MHz
Memory = 1920 MB

KiXGolf Scoring Engine
Scoring Engine = 3.3

KiXtart Golf Score
Tournament = Latin Squares
Processing Start = 2009/01/05 09:09:29.093
Processing End = 2009/01/05 09:09:29.187
Duration = 0000/00/00 00:00:00.093
KiXGolf Score = 366

 Code:
Function S($o)
Dim $i, $, $k, $t, $x

For $x = 0 to 16
	Redim $r[3], $c[3], $q[3], $s[3, 3, $x]
	
	For $i = 0 to 3
		For $ = 0 to 3
			$k = 3-2*($i<2)-($<2)
			
			$t = $o[$i,$]
			$r[$] = $r[$] + $t
			$c[$i] = $c[$i] + $t
			$q[$k] = $q[$k] + $t

			$s[$i, $, $x] = $t
		Next
	Next

	if instr(join($r),x)=0
		exit
	endif
	For $i = 0 to 3
		For $ = 0 to 3
				$k=@
				for $t = 1 to 4
					if instr($c[$i]+$r[$]+$q[3-2*($i<2)-($<2)],$t)=0 & $o[$i,$]=x
						$k=$k+$t
					endif
				next

				if ($k^)=1
					$o[$i,$]=$k
					$i=3 $=3
EndFunction
_________________________
!

download KiXnet