R, 35 bytes
rank(c(6,0,5,1:4*0,1:3)[scan()])[1]
- -6 Bytes thanks to @JayCe suggestion to switch to full program instead of function
The program returns 2
for 'greater than'
, 1
for 'less than'
, 1.5
for 'equal'
Explanation :
c(6,0,5,1:4*0,1:3)[v] # extract the score of each card in v (got from scan());
# cards in v are used as indexes in the cards rank
# vector, which is based on briscola scores vector
# c(11,0,10,0,0,0,0,2,3,4) but divided by 2 and rounded
# to integer preserving the original order
rank( )[1] # rank returns : c(1, 2) if v[1] < v[2]
# c(2, 1) if v[1] > v[2]
# c(1.5,1.5) if v[1] == v[2]
# and we select the first value