I would strongly appreciate someone laying out the calculation in detail for the above coming out with an answer of 146. The following chart that counts bottom to top for obvious reasons gives me 164.
ball score total
5 5 164
/ 16 159
6 6 143
3 3 137
X 27 134
X 17 107
7 7 90
0 0 83
4 4 83
3 3 79
X 20 76
4 4 56
/ 18 52
8 8 34
1 1 26
3 3 25
/ 16 22
6 6 6
If that is correct, then the following code is correct. If it is wrong, then I misunderstand the problem and don't have a solution at 103 characters.
sub hole {
# 1 2 3 4 5 6
+7 8 9 10
#234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901012345
$i=$s=0;for(@_=(0,0,reverse@_)){$s+=$_[$i-1]+$_[$i-(/X/?2:-1)],$_=/X/?
+10:10-$_[$i+1]if/\D/;$s+=$_;$i++}$s
}