179:
 Code:
function a($,$p)
;???
	;$r input card order
	;$p input chosen piles
	dim $t,$q,$r,$b
	;$t countdown from 52 cards
	;$q current pile number
	;$  holds value of current card
	;$b sum of values of chosen pile card values
	
	$ = Join(Split($,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 = 10*(1>$)+$-9*(65=asc($)) ;gets the current pile card value
;		? (-24 + $r*2) " $r is: " $r " from string: " $
		$ = right($,-24 + $r*2) ;removes cards from card order
;		? " leaving: " $ ?
		$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 + $r ;remove the cards from the leftover cards
			$b = $b + $r ;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