Score a game of Yahtzee
R - 264

S=sum;
P=prod;
T=function(i)table(x[i,]);
Z=function(i,...)any(sapply(list(...),function(y)all(y%in%x[i,])))
S((x[1:6,]==(R=row(x[1:6,])))*R)+ # Upper section
S(x[7,])*any(T(7)&gt;2)+             # 3 of a kind
S(x[8,])*any(T(8)&gt;3)+             # 4 of a kind
25*(P(T(9))%in%5:6)+              # Full house
30*Z(10,1:4,2:5,3:6)+             # Small straight
40*Z(11,1:5,2:6)+                 # Large straight
50*(P(T(12))==5)+                 # Yahtzee
S(x[13,])                         # Chance


(264 characters when excluding the comments)

With the input

x &lt;- as.matrix(read.table("http://pastebin.com/raw.php?i=ZRMC9B4x"))


Output

[1] 194