NICE!
thanks for the comments!

ok, so 183:
 Code:
function a($r,$p)
	;$r input card order
	;$p input chosen piles
	dim $t,$q,$,$b
	;$t countdown from 52 cards
	;$q current pile number
	;$  holds value of current card
	;$b sum of values of chosen pile card values
	
	$r = Join(Split($r,10),K) ; replaces all 10s bij K to make sure every 2 positions there is 1 card value in every 2 positions
	$t=36 ;since we have to ignore 16 cards of the leftover cards 52 - 16
	While $r
		$ = Asc($r) 
		$ = Iif($ > 65,10, $ & 15) ;gets the current pile card value

		$r = right($r,-24 + $*2) ;removes cards from card order
		$q = $q + 1 ;move to next pile (start at 0)
		If Ascan(Split($p), $q) + 1 ;check wether the current pile is one of the chosen ones
			$t = $t - 12 + $ ;remove the cards from the leftover cards
			$b = $b + $ ;add the current value to the chosen pile sum
			If $t == $b ;if both calculations match then set the output (since one counts up and the other counts down this is always the last iteration
				$a = $t
endfunction

_________________________
!

download KiXnet